One from many

Windows Server 2003 (R2) Terminal Services - qwinsta incompatible with older versions



If you encounter a problem where you are trying to connect to a Windows Server 2003 R2 (x64 not certain about 32-bit) - Terminal Services with RDP and you get the normal Maximum connections exceeded, logging onto another machine on the network and then accessing the \\\c$ of the server with the exceeded TS connections, usually allows you to run qwinsta.

However.....

Should you be on any machine other than another Windows 2003 R2 machine, qwinsta will return:
qwinsta /SERVER:
No session exists for *

Indeed you can go through all the iterations of the session numbers as well with no joy:
qwinsta 1 /SERVER:
No session exists for 1

However, if you use another 2003 (R2) server to connect to \\\c$ you will find your normal qwinsta returns the expected output.

qwinsta /SERVER:
SESSIONNAME USERNAME ID STATE TYPE DEVICE
rdp-tcp#25 0 Conn rdpwd
rdp-tcp 65536 Listen rdpwd
rdp-tcp#13 Administrator 1 Active rdpwd
rdp-tcp#20 Administrator 2 Active rdpwd
console 4 Conn wdcon

This allows you to rwinsta the session you wish to logoff.
I am not certain why this is, probably different version of Terminal Services/qwinsta.

If you do not have access to another 2003 (R2) box then maybe the last hope is using the "unknown" 3rd Terminal Services session... attaching to the console.

mstsc -v: /f -console

Alternatively, configure the settings on terminal server, Start > Control Panel > Administrative Tools > Terminal Services Configuration. Select the Connections folder from the left panel. In the right panel you should see the available connection types, right click on RDP-Tcp (Microsoft RDP 5.2) and select Properties. Select the Sessions tab and you will probably see them set to Never or not set which is why they never timed-out. To solve this problem, check 'Override user settings' option and set 'End a disconnected session' to the appropriate time limit for you.

Of course there are cases where you indeed do not want to disconnect sessions, in these cases, I hope this hopes some poor soul to gain access to their server once again.

Worked around, let me know if this helps anyone.