Force windows 2003 session to log off (RDP)

We have a number of Windows 2003 machines that we RDP on to. Naturally, a lot of people forget to log off, and simply close their rdp window - which causes the max number of sessions exceeded error.

I was just wondering if there was a setting I can set (maybe in group policy?) that forces the session to log off after a period of time?


Solution 1:

Yes, there is a GPO setting for it located in computer config. You can set it to close out both idle and disconnected sessions after a certain amount of time

Computer Config\Admin Templates\Windows Components\Terminal Services\Sessions

'Set Time limit for active but idle Terminal Services sessions'

'Set time limit for disconnected sessions'

Solution 2:

If you need to do this immediately, the command line syntax is -

query session /server:<servername>, (will show you the logged on sessions and users)

logoff <sessionID> /server:<servername>

Solution 3:

As Shial mentioned, you can indeed do it in GPO. You can also do it from the Terminal Services Configuration app as well.

Right-click on RDP-TCP for properties and check out the "Sessions" tab.