I want to start another program which runs as user from a program running as administrator.
The problem is that the second program needs to use outlook, which is not possible if the program runs as admin. The main program needs to run as admin.
I did already come up with this two solutions:
Process.Start("cmd.exe", @"/C runas.exe /savecred /user:" + Environment.UserDomainName + "\\" + Environment.UserName + " " + "\"SomeProgram.exe" + "\"");
or
Process.Start("explorer.exe", "SomeProgram.exe");
But i have a problem with both solutions. The first one asks the user for the password (only the first time after windows was restarted). The second one probalby won`t work in the future, because as far as i found out it is considered as a bug and probably fixed with an future update.
So I would like to know is there any other solution, where the user does not need to enter his password?
This seems to work for me:
Process.Start("cmd.exe", @"/C runas.exe /TrustLevel:0x20000 " + "\"SomeProgram.exe" + "\"");
runas /trustlevel
thing leaves the process in a weird state and should probably be avoided. See https://mcmap.net/q/22627/-do-high-integrity-tokens-have-to-have-the-administrators-group-enabled/886887 – Asphyxiant