I have three accounts on Windows 2008: Admin, User1, User2, User3. I would like to run GUI program from Admin account using c# on these User1, User2, User3 accounts. The problem is that while using Process.Start
with User1 or any other user credentials the GUI app starts on Admin user desktop. I would like to run program on User1 desktop.
I would like to simulate behavior like manually we do: Switch User, Login with User1, Run GUI program.
Is it possible to do that?
Asked
Active
Viewed 1,416 times
1

Tomas
- 17,551
- 43
- 152
- 257
-
1I'm not 100% sure but I think you can use runas: http://ss64.com/nt/runas.html – Sandeep Bansal Jun 25 '12 at 15:32
-
Do you really want to switch user? How about just impersonating one http://stackoverflow.com/questions/125341/impersonation-in-net – Slugart Jun 25 '12 at 15:34
1 Answers
1
You should be able to run the program using different user credentials, if that's what you mean.
var processInfo = new ProcessStartInfo
{
FileName = "app.exe",
UserName = "Username",
Domain = "yourdomain or leave blank",
Password = "password",
UseShellExecute = false,
};
Process.Start(processInfo);

Bali C
- 30,582
- 35
- 123
- 152
-
This do not work because logged user use HOST USER DESKTOP. Let's say I run HOST app on Admin account. Host app run GUI app with User1 credentials. The launged app will run with User1 credentials but on Admin desktop. – Tomas Jun 25 '12 at 19:11
-
Did you ever get a solution to this, i.e. spawning the program on the user's desktop? Thanks! – joelc Mar 18 '15 at 02:24