Windows server 2000/2003 allows two remote terminal services connections for administrative purposes.  Every once in a while I’ll get the “You exceeded the allowed connection count” message when trying to connect to a server via RDP, because previous sessions were not disconnected correctly.

You can use either of the following methods to remotely disconnect Terminal Server sessions.

Method 1

You can normally run the Terminal Services Manager program on another server, or even from a Windows XP workstation, to disconnect Terminal Services connections by clicking StartRun and then typing

%SystemRoot%\system32\tsadmin.exe

This will launch the local copy of Terminal Services Manager.  Next right click on All Listed Servers and select Connect to Computer.  Type in the name or IP address of the server you wish to manage.

Select your server from the left pane, then select the Sessions tab from the right pane.  Right click on the session you wish to disconnect and select Disconnect.

You should now be able to login to the target server via Terminal Services.

Method 2

Authenticate to the server you wish to manage.  You can easily accomplish this by mapping a network drive to a share on the target server.  Start a command prompt and type

qwinsta /server:yourservername

where yourservername is the name or IP address of the server you wish to manage.

In my case I ran qwinsta /server:10.0.0.2

 

You can see the Administrator account is logged into session 0 and the admin account is logged into session 1.  To disconnect the admin session with ID=1 I’ll run the following from a command prompt:

rwinsta ID /server:yourservername

where ID is the process ID of the session you wish to terminate, and yourservername is the name or IP address of the server you wish to manage.

In my case I ran rwinsta 1 /server:10.0.0.2

I again ran qwinsta /server:10.0.0.2 which verified session 1 had been disconnected.  I confirmed that I was once again able to login to Terminal Services.