Tuesday, November 8, 2011

How to fix remotely - Terminal server has exceeded the maximum number of allowed connections.

How annoying is this message?  It seems every time I've run into this issue it's because some user incorrectly exited of the session and their session thinks it's still connected.  Well don't beat your head over this one, it's actually a pretty simple fix.

First make sure you are logged into the client computer as a domain Admin user.
command: net use /user:[username] \\servername
 ex:            net use  /user:GenericUser \\Generic-Server
                "Enter the password for 'GenericUser' to connect to 'Generic-Server':"
                       #if you typed in the right pass
                "The command completed successfully"

From here, we need to see which users have open sessions on the box.  To do this type the command:

query session /server:[servername]


Using the previous command displays which session ID's are currently logged into the client machine.  The next step is booting that user from the box.

reset session [ID] /server:[servername]

now if you run the query session command, you should see that the offending session ID has now been disconnected.

Alternative commands:

If you've been googled this issue and have seen commands such as: qwinsta, rwinsta, and logoff being used, these are alternative commands to what I listed.  You can substitute qwinsta for "query session" and substitute logoff for "reset session".  Everything else in the command stays the same. Rwinsta is another alternative for logoff or reset session, however, the session ID comes after the server name.  Listed below are examples of each alternative command being used:

qwinsta /server:[servername]

rwinsta /server:[servername] [sessionID]

logoff [sessionID] /server:[servername]