Manage Remote Desktop Sessions from CMD
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.
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.
The Ip address or domain name of the Remote server should be entered in place of SERVERIP
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.
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.
Source : TechTalkz