Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as off topic by Zoredache, longneck, mdpc, Scott Pack, Ward Nov 9 '12 at 3:39

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted
  • 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

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.