14 May 2008

Windows Terminal Server - Maximum connections blegh.

Don't you just love proprietary software? It restricts you in the most irritating manner.

I unfortunately had to do something on a Windows 2003 server, and I normally go about by using the wonderful Remote desktop protocol. Linux has an excellent client implementation of it, and I use it more often than VNC for Windows servers.

This time however, I was alerted with this error:
"The terminal server has exceeded the maximum number of allowed connections."
Translation: "Nye-nye! Buy CALs!"

Not wanting to be a neanderthal by rebooting the machine, I decided to see if I could circumvent this "problem" with a bit of Googleducation. Well, it seems its possible with Windows 2003. You can actually make use of the "console" session if your login has the role of an administrator. To access the console, or "session zero", in Linux its like this:
# rdesktop -0 192.168.1.6
... where you replace your server IP address with the example provided above. The "-0" flag indicates that you want the console session. In MS-DOS's command.com, supposedly, because I havent tried it, its:
C:\> mstsc -v:192.168.1.6 /f -console
Once you are in, and get some scary errors about kicking out the currently logged in person, you can view the RDP session which have been hanging around, taking up the precious license seats.

The command.com commandline command is:
C:\> query session
Subsequently, you can delete the Disconnected / Orphaned / Stray / Dismembered sessions using this command, which is very similar to vncserver -kill :[screen #]
C:\> reset session [session ID]
You can disconnect ALL sessions by selecting the highest ID (usually >65536) e.g.
C:\> reset session 65538
Obviously I tried it once and got kicked out of by remote desktop. Heh. Cheap thrills.

So there you have it: how to retain access, and a simple way of 'resetting' your Windows 2003 server's remote desktops without having to reboot the darn thing, because of the artificial restrictions placed on software based on user access licensing.

yk.