3

I am trying to achive a situation:

  • I am logged as a user on my account.
  • I've created a two more accounts which I will try to log on in the "background"
  • And now I want to execute my code to log on different user in the background, so that if i can click ctrl+alt+del and go to the switch user screen i can see that another account was logged on the system.

During investigation I've read that this was possbile with some undocumented winapi methods before Microsoft implemented Fast User Switch(FUS) which replaced GINA.


I don't want to Impersonate code as user. I want to start up the whole windows session for a user from code.

I've tried to do sth with CreateProcessWithLogonW() but this was unsuccessful.

Big virtual beer for anybody who can give me a hand with this! :)

Deanna
  • 23,876
  • 7
  • 71
  • 156
gkmiec
  • 41
  • 3
  • 1
    There are some pointers here: http://social.msdn.microsoft.com/Forums/is/windowssecurity/thread/5b1d6208-2542-4cf7-858b-2d28c0cd754f – arx Feb 03 '12 at 14:29

1 Answers1

0

Okay had to do a bit of digging to figure this out my self.

Essentially you would need to run a command in command prompt.

This should load explorer.exe as a second user.

runas /user:*computer name\*account name explorer.exe

Follow this to get an idea on running a command line command via c#:

How To: Execute command line in C#, get STD OUT results

Other sources:

http://www.computerhope.com/runas.htm

http://lifehacker.com/290435/switch-user-accounts-from-the-command-prompt

Community
  • 1
  • 1
Anicho
  • 2,647
  • 11
  • 48
  • 76