Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

RD Stuck?

 

Oops

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
Copyright (C) 2001-2007 Mark Russinovich
Sysinternals – www.sysinternals.com

SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
>console                                     0  Conn    wdcon
rdp-tcp                                 65536  Listen  rdpwd
                   user1                     1  Disc    rdpwd
rdp-tcp#21        user2                     2  Active  rdpwd
qwinsta exited on MyServer with error code 0.

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
Copyright (C) 2001-2007 Mark Russinovich
Sysinternals – www.sysinternals.com

Logging off session ID 2
logoff exited on \\MyServer with error code 0.

Output of log off
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

9 Responses to RD Stuck?

  1. Masood says:

    Awesome! It works in a fantastic way, Thanks for sharing :)

  2. Dave Woods says:

    The /console flag has saved me many a time:

    mstsc /v:ServerAddress /f /console

    (the /f is for full screen)

  3. Ian Nelson says:

    What Rune said – why not just use the /console switch?

  4. 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

  5. Greg says:

    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.

  6. The Other Steve says:

    Or grab the windows 2003 admin tools and run Terminal Services Manager.

    still, doing command line makes you an uber-geek

  7. IainP says:

    The other option to do is in AD you can tell accounts to log off of TS if inactive for an amount of time

  8. Rune says:

    How about just using the /console switch to connect to the server – or is that not a viable option?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>