I use Windows Server 2008.

I am looking for a way to automatically start a user session when I power on my workstation.

Scenario: 1) I deploy a remote virtual machine with Windows Server 2008; 2) I configure Logon script on this VM to run some processes; 3) I need to start a user session automatically when I power on this VM to run the the automatic tests there. Note, I can't run the tests under the System. I need a user session with Desktop because I use TestComplete tests to make GUI testing.

Does anybody have an idea how to do this ? I have already tried automatic Windows Logon functionality but seems it doesn't help anyway. When I restart my VM - it doesn't start user's session automatically.

Thank you!

migrated from stackoverflow.com May 15 '11 at 6:23

This question came from our site for professional and enthusiast programmers.


Setting DefaultUsername and DefaultPassword values in conjunction with AutoAdminLogon does work with Windows Server 2008. Where exactly did you have problems with this process?


Try to import the following registry data (first save as "AutoLogon.reg", then right-click -> merge):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonChecked]


Now restart your machine, and check if that user logged in (task manager -> users) from another user session.

EDIT : If you're getting black screenshots or other GUI problems (when using Selenium, Test Complete, etc.), then create a batch file that disconnects Remote Desktop, instead of closing the RDP session with the regular X button:

%windir%\system32\tscon.exe %SESSIONNAME% /dest:console

For the graphical user fans under us, see this tutorial:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy