From an application that is not being run as administrator, I have the following code:
ProcessStartInfo proc = new ProcessStartInfo();
proc.WindowStyle = ProcessWindowStyle.Normal;
proc.FileName = myExePath;
proc.CreateNoWindow = false;
proc.UseShellExecute = false;
proc.Verb = "runas";
When I call Process.Start(proc), I do not get a pop up asking for permission to run as administrator, and the exe is not run as administrator.
I tried adding an app.manifest to the executable found at myExePath, and updated the requestedExecutionLevel to
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
With the updated app.manifest, on the Process.Start(proc) call, I get an exception, "The requested operation requires elevation."
Why isn't the .Verb action not setting administrator privileges?
I am testing on Windows Server 2008 R2 Standard.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…