6

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.

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.

8
  • 1
    Great, thanks. Also: you can login via rdp and then instead of disconnecting manually, you can execute this as a bat file (admin rights required): for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do ( %windir%\System32\tscon.exe %%s /dest:console ) – user3726374 Feb 1 '18 at 9:16
  • @user3726374 Hello does this work with GUI applications so that they can run in the background without having to have a user logged into the system? – Vesnog Jun 6 '18 at 22:07
  • 1
    @Vesnog No, a user needs to be logged on. In this case though, you do not need any extra machine to display the desktop. The login is running in the background. – user3726374 Jun 8 '18 at 10:58
  • @user3726374 Hi. Have you found a solution to this issue? I'm having the same problem while automating remote software testing. – Gabriel Ambrósio Archanjo Dec 12 '18 at 19:27
  • @GabrielAmbrósioArchanjo We are still using the technique with the mentioned script. So far everything is working well. – user3726374 Dec 13 '18 at 13:41
0

The only way to do that that I am aware of is a 3rd party tool called FireDaemon.

The FireDaemon suite of software products allows you to create, manage, monitor, schedule and control FireDaemon and Windows services easily. FireDaemon Pro allows you to setup and run any third party or custom application program or script as a Windows service. FireDaemon Fusion allows you to manage and control FireDaemon and Windows services via your browser, tablet or phone. FireDaemon Zero (Session 0 Viewer) allows you to manage interactive services running on Session 0. FireDaemon daeMON gives you the ability to monitor resource consumption and control individual or groups of FireDaemon or Windows services. FireDaemon Session 0 Input Restorer reinstates Session 0 functionality removed by Microsoft on Windows 10 and Server 2016.

We use it on an old 2003 box to run rules in Outlook for an ancient (and soon to be deprecated) application. Outlook only works if someone is logged on to the machine. Firedaemon makes it appear that we are always logged on. You also don't have to always be RDPd and logged into the machine with it.

To lay out all the fact, I found this application to be a little clunky.

1
  • Thanks for the hint. Although, I think this is not what we are looking for. Our server does not log out once no one is connected via RDP. Our problem is rather that no actual display seems to be active. E.g. if automatically taking a screenshot in the test, the resulting image will always be blank (but with the correct resolution). If there is any setting, it is probably located within windows itself... – user3726374 Jan 24 '18 at 13:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.