How to View / Disconnect Remote Desktop Sessions from Commandline

by Hemanth on January 26, 2009

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“

Session Exceeded

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. :D

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.

Remote sessions list

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

Disconnect Remote Session

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

Disconnected Remote Sessions List

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.

Disconnected-Server-Session

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.

Related Articles:

  • X-NetStat Pro – View your Internet and network connections in realtime
  • Mozilla Firefox Tips and Tricks
  • How to use SSH (Putty) behind a Proxy/Firewall?
  • Recursively change only directory permissions on Linux (Chmod)
  • “Last account activity” – Find out who else is using your Gmail Account!
  • { 9 comments… read them below or add one }

    Pat April 14, 2009 at 5:31 am

    This is good sharing!!!
    Thanks.

    Reply

    Kaiserskorpion April 14, 2009 at 7:36 pm

    Excellent, this is very usefull!

    Thanks Bro!

    Reply

    gogon May 15, 2009 at 11:49 am

    many thanks
    it works man!

    Reply

    gogon June 5, 2009 at 9:54 am

    thanks a lot
    it works!

    Reply

    Hari August 22, 2009 at 1:59 am

    Thanks a lot for sharing this info.

    Reply

    Pankaj September 10, 2009 at 10:55 pm

    This tip saved a lot of headache for me today. Thanks a ton.

    Reply

    vip October 26, 2009 at 5:34 pm

    Excellent Mate!!

    Reply

    ISP October 31, 2009 at 2:27 am

    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.

    Reply

    Prakash Mannil November 3, 2009 at 5:53 pm

    Thanks a lot buddy!!

    Reply

    Leave a Comment