How to Automatically Log Off Disconnected Remote Desktop / Terminal Services Sessions
I've frequently heard complaints about people forgetting to log off when they end a Remote Desktop session. Instead they simply close the window, leaving their session running on the server. This orphaned session becomes a problem in many cases because Windows Servers are typically only licensed for two simultaneous logged in users. Even worse, if you can't remote into the box, you may not be able to easily identify the culprit(s) who left their sessions active. This leaves you no-one to throw things at and generally a very grumpy person.
Fortunately there is a solution to this problem...
You can configure Terminal Services to terminate abandoned sessions fairly easily on Windows 2000 and 2003 servers by doing the following:
- On the server, go to "Start > Programs > Administrative Tools > teminal Services Configuration"
- Select "Connections", then right click on RDP-Tcp and select Properties
- Select the Sessions tab and Check the "Override user settings" checkbox.
- Choose the criteria under which you'd like to start killing off sessions.
That does it!

# Posted By Dan Roberts | March 10, 2008 9:03 PM
# Posted By Lee | April 8, 2009 4:57 PM
# Posted By Felipe | April 26, 2009 11:59 AM
@echo off
Quser /server:XXXXXXXX > loggedon.txt
for /f "tokens=2" %%a in ('"FIND "Disc" loggedon.txt"') do set User=%%a
IF NOT %User%==LOGGEDON.TXT rwinsta /server:XXXXXXXX %User%
# Posted By Pantera975 | May 22, 2009 11:18 AM
# Posted By Tom | July 30, 2009 6:45 PM
# Posted By tanks guyTHANKS | August 7, 2009 4:10 AM