Avoiding Session 0 Auto Logout with FireDaemon Pro and AutoIt


TIP: Check out FireDaemon Zero. It supersedes the method of switching to and remaining on Session 0 outlined below. Also, check out our comprehensive series of articles relating to Session 0.


Session 0 is the default Windows session where interactive FireDaemon Pro services are run. You can use the Interactive Services Detection Service prompt or the FireDaemon Pro Switch To Session 0 button to switch to Session 0 from your currently logged-in desktop.


Interactive Services Detection


FireDaemon Pro Main Screen


Irrespective of whether you are at your machine's physical console or you RDP into your server, Session 0 will automatically log you off if there is no mouse or keyboard activity seen after 60 seconds or so. To get around this, you can use FireDaemon Pro in conjunction with AutoIt to inject synthetic mouse movements and mouse clicks into Session 0. Note that you cannot RDP directly into Session 0 nor return to Session 0 directly if your RDP session was closed. Note that this technique may work with Team Viewer and other similar remote control applications (but you will need to test them). So here's what you need to do:


1. Download and install FireDaemon Pro


2. Download and install AutoIt


3. Create an AutoIt script in a text editor (e.g. Notepad) with the text below. Save the script in the folder of your choice (e.g. C:\AIScripts). We have called the script: s0-keys.au3


While (1)
MouseMove(10,10);
MouseClick("left");
Sleep(30000);
WEnd;


This script is really simple. It moves the mouse to certain X and Y coordinates and clicks the left mouse button. The script then sleeps for 30 seconds and repeats the process all over again. You can adjust these settings as you feel necessary but don't make the Sleep too low (e.g. less than 10 seconds) as the script will run again rapidly and you might find you have lost control of your mouse!


4. Now create the following FireDaemon Pro service. Install the service, then switch to Session 0 and you will find you are no longer automatically logged off Session 0!


FireDaemon Create New AutoIt Service


Read our AutoIt integration guide for more information on running an AutoIt script as a service.