I used to receive the maximum number of connections error message when I try to log on to the Windows 2003 Server in my office via Windows Remote Desktop.
“The terminal server has exceeded the maximum number of allowed connections“

This is pretty annoying if you have some urgent work to do in the server. Most of the already logged in users won’t even be using the session at the time, but I can’t login! So how to solve this? After a bit of googling, as usual, I found a simple way to disconnect other remotely logged in sessions. ![]()
First of all you must be logged in to your client computer as a domain Admin user. Now open the command prompt and type in the following command.
qwinsta /server:SERVERIP
The Ip address or domain name of the Remote server should be entered in place of SERVERIP
Example:
qwinsta /server:10.10.1.10
You will get a list of the Remote Sessions in the command window.

In the above sceenshot we can clearly see an Active RDP session with the ID 2 which belongs to the user Administrator. In order to disconnect that user we are going to use the session ID. Use the following command line to disconnect the remote session.
rwinsta /server:SERVERIP SESSIONID
For example in order to terminate the session of the Administrator user the following command should be given.
rwinsta /server:10.10.1.10 2

Now let’s confirm if the user is really disconnected. Just type in the qwinsta command in proper format.

As you can see our session with ID 2 is no longer there. Now for the user we just disconnected will see the following message.
The remote session was disconnected because you session was logged off at the remote computer. Your administrator or another user might have ended your connection.
So we are done with the remote session management over command lines.
{ 21 comments… read them below or add one }
This is good sharing!!!
Thanks.
Excellent, this is very usefull!
Thanks Bro!
many thanks
it works man!
thanks a lot
it works!
Thanks a lot for sharing this info.
This tip saved a lot of headache for me today. Thanks a ton.
Excellent Mate!!
If you are a domain admin, you can just use the “SERVER /console” or “SERVER /admin” in the RDP dialogue so you can log on to the console instead. Much easier than remotly logging another admin user off.
Thanks a lot buddy!!
Thank you that was very helpful and much appreciated!
Please note that with remote desktop there is a difference between logging off a user and disconnecting a user. When you disconnect a user only the connection is dropped (marked as inactive) but the session is still active – all of the programs are left running.
Task Manager has the option to either disconnect or logoff, so I’m still hoping to find a command line way to do the disconnect only.
Cheeeers
thanks bro
great advice! commands work a treat!
Thanks for sharing
Its good……….. it worked !!!
Hi,
Thanks, This is very easy, I was using TSadmin – GUI to disconnect the sessions
Hi,
Thanks a lot!!
it is really good
thank you
Saved me a lot of time!
Thanks a lot!!!!
thx a lot! Very usefull!
Thanks, thanks, thanks, …
Good explanation!