I only get these “Terminal server has exceeded the maximum number of connections” when its 3 am and I am dealing with a production problem where I absolutely need access at that moment. Naturally any admin etc is sleeping and unavailable. Personally walking to the office in my jammies is something I like to avoid so I figured there had to be a better way to get around it and there is. perhaps this is not interesting but I would have bookmarked this a while ago if I had seen it before.
Step 1: Download psexec from microsoft http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
Step 2: Unzip into a folder (let’s say c:\pstools)
Step 3: psexec \\yourserver -u yourusername -p yourpassword qwinsta you will get an ouput like this:
|
C:\PsTools>psexec \\MyServer -u gregy -p YeahRight qwinsta PsExec v1.93 – Execute processes remotely SESSIONNAME USERNAME ID STATE TYPE DEVICE |
| Output Qwinsta |
Step 4: Kill a connection. Grab the ID field in the above and use it in psexec \\yourserver -u yourusername -p yourpassword logoff ID /v
|
C:\PsTools>psexec \\MyServer -u gregy -p YeahRight logoff 2 /v PsExec v1.93 – Execute processes remotely Logging off session ID 2 |
| Output of log off |
Awesome! It works in a fantastic way, Thanks for sharing
The /console flag has saved me many a time:
mstsc /v:ServerAddress /f /console
(the /f is for full screen)
What Rune said – why not just use the /console switch?
I don’t get why you need to use psexec to run qwinsta, instead of the /server parameter.
Is there an advantage to:
psexec \\MyServer -u gregy -p YeahRight qwinsta
over:
qwinsta /server:MyServer
and then to kill a connection
rwinsta [ID] /server:MyServer
This is why I am not a system admin (well that and the fact that I would forget the 37 character admin password)
Benefit to my solution? I now have a script to do it.
Or grab the windows 2003 admin tools and run Terminal Services Manager.
still, doing command line makes you an uber-geek
Already addressed awhile ago but still useful. http://labs.redbd.net/blog/index.cfm/2007/7/31/Easily-kill-remote-desktop-sessions-to-your-server
The other option to do is in AD you can tell accounts to log off of TS if inactive for an amount of time
How about just using the /console switch to connect to the server – or is that not a viable option?