There are only 2 users allowed for administration so occasionally both are used up and you can’t access the server. This may happen if two people are legitimately using the servers or if someone forgot to log off.
You would think this would be as easy as connecting to the remote server by adding the Terminal Services Manager snap-in to a MMC console or remotely stopping and starting the service (in a pinch). Strangely, these obvious solutions aren’t available. Terminal Services Manager doesn’t exist as a snap-in to connect to a remote machine and because the TermService service is a core system service, you can’t even stop it on the local machine, let alone a remote one.
Fortunately there is an easy solution. Windows 2000+ (includes Windows XP and 2003) have two command-line tools called qwinsta and rwinsta that can query and reset a remote session.
For example, let’s say that you can’t gain access to a server using Terminal Services because both sessions are used up. You can use another server to check the status of the first one. As long as the logged in user has administrative rights on the non-accessible machine you would run this:
Where 184.108.40.206 is the IP address or name of the non-accessible machine.
This will display something like this:
> qwinsta /server:220.127.116.11
SESSIONNAME USERNAME ID STATE TYPE DEVICE
console 0 Conn wdcon
rdp-tcp 65536 Listen rdpwd
rdp-tcp#470 Bob 1 Active rdpwd
rdp-tcp#471 Jane 3 Active rdpwd
Now you know that Bob and Jane are the two that are logged in. Since Jane left the office 20 minutes ago you know that she forgot to log off. You don’t know where Bob is but you only need one session so you’ll ignore him for now.
To disconnect Jane’s session you would type this:
rwinsta /server:18.104.22.168 3
Notice the 3 which is the session ID you found from using qwinsta above.
Yet another option with W2K3 is a new feature that lets you connect to the desktop directly and gain a 3rd session.
You probably noticed that rwinsta and qwinsta seems like strange names. This came from the Citrix Metaframe days which Terminal Services has descended from. It stands for:
qwinsta = Query WINdows STAtion
rwinsta = Reset WINdows STAtion
One final comment. Microsoft has replaced these two tools with Query but since qwinsta and rwinsta is fully compatible with W2K WinXP and W2K3.