The way to elevate a new process programmatically is to ask the shell to execute the executable file using the verb runas
. That's the only supported way to do it. In order to pass the runas
verb to the shell, you need to call a suitable Win32 API function. Possible candidates include ShellExecute
and ShellExecuteEx
.
The UseShellExecute
property determines which API call is used when you call Process.Start
. If UseShellExecute
is true
, then ShellExecuteEx
is called. Otherwise CreateProcess
is called.
So, when you set UseShellExecute
to false
, you switched to using CreateProcess
. And CreateProcess
does not have any mechanism to elevate the new process. So when UseShellExecute
is false
, the runas
verb that you provided is simply ignored because CreateProcess
does not receive shell verbs.