vb.net.net-4.0processuacmanifest

How to use ProcessStartInfo to run at lowest execution level


I have an application that runs using as AsInvoker manifest, this uses ProcessStartInfo to run another application that is using a HighestAvailable manifest (in my case this runs as Admin and I get the UAC prompt) the first app then quits.

The second app then uses ProcessStartInfo to run the first app again, this time it runs as admin (no UAC prompt) I guess this is correct because it is AsInvoker and it is being invoke from an application that is running as admin, but I actually want it to run without Admin rights - or more correctly run it with the lowest possible execution level

I know you can use ProcessStartInfo.Verb = "runas" to elevate but can you descend?


Solution

  • No, you cannot "go back down" (There are several answers on this site and external tutorials that claim otherwise, but they all have problems in certain scenarios, this answer from a MS employee confirms that this is the case)

    Your only real option is to use a AsInvoker bootstrapper/parent process that can launch unelevated processes. (And even this will fail if the bootstrapper is started elevated, but in those cases the user manually chose to run as admin)