Is there a way to avoid UAC for an autorun application in Program Files?

Firstly, I want to emphasize that I am not trying to do anything “unpleasant” or “hacking,” and I am not trying to hide anything from the user here.

During the installation (using InstallShield LE) of my application, the user asks for Windows UAC so that it can work in administrator mode; If the user accepts it, the installation continues (standard behavior), and the user can again check the possibility of adding this program to the startup list (by adding a registry key to HKLM /../ Run). Everything is normal and normal. But after each restart of Windows, when this application starts, UAC starts and asks for user permission. The question is how to avoid it, since it is a bit annoying (but my application needs administrator rights to run)?

I mean, the user has already granted such permissions during installation, so I don’t see the reason why I need to request it every time I start it? Moreover, I believe that most antivirus programs, etc. They also require elevated permissions to work, but the UAC does not request it when Windows starts.

Thank you for any tips, information, comments or solutions.

+4
source share
4 answers
  • Do you really need your app to enhance? Or will higher access be required later when the user uses it to perform an action? If possible, drop the subsequent administrator task into a separate exe so that the main exe starts without a mark - when you turn off the workflow later, it will query the UAC on demand.

  • During the installation, as you already noted, you upgraded the installation. If you want to run the elevated code on subsequent launches, automatically, this is the point to install the service - this is what all the other applications you talked about do.

+4
source

You cannot bypass the UAC for a process running in an interactive session. You can use a service that runs as a privileged user, but it would be much better for you to find a way to do everything you do without requiring administrator privileges.

+1
source

Unable to start the program without a hint. What you want to do is those parts of the application that need to be upgraded to a Windows service that runs as a system. Then your autostart application can make remote calls to the service to degenerate the actions that the user cannot do without promotion.

+1
source

Not done, but I found this article to selectively disable UAC for your trusted Vista applications , which says that use Microsoft Application Compatibility Toolkit .

Compatibility Administrator allows you to create a compatibility fix database that allows you to run specific applications without an accompanying UAC.

  • Run Compatibility Administrator as admin
  • select a new database template
  • Click the Fix button on the toolbar. When you see the Create New Fix Application Wizard ... enter information about your application.
  • Choose Compatibility Level
  • Choose RunAsInvoker as a fix

It seems that last

Selecting the RunAsInvoker option allows you to run the application without requiring a UAC invitation.

Should do what you want if invoker is an administrator, and I think you can do it at startup using the scheduler: Create admin mode shortcuts without UAC prompts in Windows 7 or Vista

As you can see, it launches your application in compatibility mode, which may or may not be acceptable to you.

0
source

All Articles