0

I am attempting to start a hidden console application, but require the application to have elevated privileges.

I have successfully managed to have the UAC prompt appear, however can't get it to appear when I try to start the process hidden.

ProcessStartInfo proc = new ProcessStartInfo();
proc.UseShellExecute = false;
proc.FileName = "C:/example.exe";
proc.CreateNoWindow = true;
proc.Verb = "runas";

This will result in a process starting in the background, except without a prompt appearing (and without elevated priveleges). If I change UseShellExecute to true, then the UAC prompt appears, however the console window is visible too.

Joel
  • 1,580
  • 4
  • 20
  • 33

1 Answers1

0

You need to set WindowStyle to ProcessWindowStyle.Hidden, as Jexus Manager shows,

https://github.com/jexuswebserver/JexusManager/blob/be90688abd03780a714dc401054e22fa4afa2be3/Microsoft.Web.Administration/IisExpressServerManager.cs#L41

Lex Li
  • 60,503
  • 9
  • 116
  • 147