Tomas
Tomas

Reputation: 18097

How to run GUI program using different user

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?

Upvotes: 1

Views: 1540

Answers (1)

Bali C
Bali C

Reputation: 31221

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); 

Upvotes: 1

Related Questions