Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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'

share|improve this answer

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>

share|improve this answer

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.

share|improve this answer

'Set time limit for disconnected sessions'

A "closed RDP Window" is in effect a disconnected session, so this is the setting to go with. Keep in mind though, that a user who suddenly loses WLAN ceverage and "falls off" is essentially the same, so set this high enough so that you allow users to log back into their session. A couple of minutes if you want to be strict, an hour if you want to be loose. Be sure to inform end-users of whichever policy you set, so that they don't get any unexpected results (I have some customers who assume that they can disconnect their session, shut down their laptops, go home, have dinner, and then reconnect into the same session. THis requires a longer disconnect time limit.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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