How to run another application as administrator in Windows XP

I used the application manifest file as described here so that part of my application works with elevated privileges (what it needs).
Therefore, when necessary, the main program simply calls a small assembly using Process.Start, which then processes the task, which requires administrator rights.

However, how can I do the same in Windows XP?
XP seems to just ignore this manifest and start a small build in the current user context.

+6
c # windows-xp uac elevation
source share
3 answers

The following code here does exactly what I need:

ProcessStartInfo processStartInfo = new ProcessStartInfo("path", "args"); processStartInfo.Verb = "runas"; using (Process process = new Process()) { process.StartInfo = processStartInfo; process.Start(); process.WaitForExit(); } 

So actually you need to install "runas" on ProcessStartInfo.Verb. With an attached manifest, this code now works fine in Windows XP, Vista, and 7.

Update:
See also this answer to a similar question . This is basically the same code, just using arguments.

+9
source share

You can use the runas command.

+3
source share

Windows XP does not have UAC.

You need to call Process.Start with user credentials with administrative privileges.

+2
source share

All Articles