Remote Windows Server virtual machine: always keep Desktop open (simulate RDP session)

We have got a Windows server 2012 VM running continuously. We log on to the machine via remote desktop.

Is there any possibility to always keep the Desktop open as if a user would be logged on via remote desktop?

Background: we are running automated GUI software tests which break at some point if no one is actually "looking" at the desktop.


Solution 1:

Use Autologon to automatically logon via a true Console session

You can try configuring the server to automatically log on a user account on system startup. This is accomplished by configuring the registry.

  1. In the Registry, navigate to the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  2. As necessary, create and populate the following values. They are all of type REG_SZ (String):

    Value                Data           Example
    -----                ----           -------
    AutoAdminLogon       1              1
    DefaultDomainName   <Domain_Name>   CONTOSO
    DefaultUserName     <Username>      JohnDoe
    DefaultPassword     <Password>      P@ssw0rd!
    
  3. Reboot the computer for the change to take effect. The specified account will automatically be logged on.

Be sure the software you wish to run starts automatically when this account logs in.

The difference between logging into the computer via this method and by initially logging on the account by establishing a Remote Desktop session is that this method is the equivalent of logging in at the machine's physical console. As a result, programs that do not play nice in an RDP session are more likely to work correctly.

Be aware that this, in fact, does logon an account at the machine's physical console. Any user that has access to the console, including via a virtual machine management interface, will be able to access the machine via this already logged-on user account. Take this into account when using this method.