2

When the UAC is disabled, an application is launched in regular mode (i.e., it does not take into account the manifest) and the credentials window (for the administrator's login/password) does not appear.

Is there any way to force the Windows OS running the (.NET) application to run under Administrative Privileges (like the "Run as administrator" context menu does) from the (.NET) application code if the UAC is disabled?

1 Answer 1

1
  • Right Click on the application and go to Properties
  • Go to the "Compatibility" tab
  • Check the "Run this program as an administrator" check-box.

C# .Net code to run an application with admin permissions:

ProcessStartInfo startInfo = new ProcessStartInfo(cmd); //cmd is the application you are trying to start
startInfo.Verb = "runas"; // This will set it to run as an administrator
startInfo.Arguments = args; // arguments to pass to the application that is being started
Process.Start(startInfo);

You can find some more info on this here

4
  • and how to do this from the (.NET) application code?
    – Mikhail
    Nov 8, 2012 at 0:19
  • I updated my answer to have some C#.Net code. Nov 8, 2012 at 0:32
  • thx, however, it seems to be does not work when the UAC is disabled. continue researching...
    – Mikhail
    Nov 8, 2012 at 0:56
  • @Mikhail, strange I use it on my own system without any issues and I have UAC disabled. Win7 x64 Nov 8, 2012 at 1:17

Not the answer you're looking for? Browse other questions tagged .