The terminal server has exceeded the maximum number of allowed connections

When a user tries to connect to a machine using Remote Desktop connection, they might come across this error message.

The terminal server has exceeded the maximum number of allowed connections

This is because Windows Server only allows two connections through RDP, and you’ve either got two people already logged on to that machine, or you’ve got disconnected sessions that still thinks they are active. If a user simply closes the remote desktop window when they’re finished, that user will still remain logged on, unless there is a time out configured in Terminal Services Configuration as follows

Terminal Services Configuration

Terminal Services Configuration

If the Session time out is not configured, or the logged on users are not available, you wont be able to logon to the machine. To overcome this limitation, follow the steps as below.

open a command prompt or type in the RUN prompt

mstsc /v:[] /f -console

eg: mstsc /v: /f -console
mstsc /v:ADSURF /f -console

This will connect to the physical console session on the server (also known as “session zero”). You will then be prompted with the login box and provide the administrator details. Then you will be connected to the Console Session on the server. Now you can reset the disconnected user sessions from Terminal Services Manager. Please note that if you get disconnected from this console session, you will  have to go physically to the machine.

More info on mstsc at Technet

If you have Windows Vista with SP1 or Server 2008, use the following syntax:

mstsc /admin

If you use the old switch “/console”, it will just ignore that and proceed connecting. In Windows Server 2008, the /console switch doesn’t exist anymore because “session 0” is a non-interactive session that is reserved for services. Difference between admin and console swtich are here.

Another workaround:

You can also query the sessions on the remote machine as an administrator of that machine. Open a command prompt as a domain administrator that the remote machine is set to or map a drive of that remote machine.

Then in the command prompt, type as below:

query session /server:servername

Replace servername with the remote machine name or IP address.

Now we have the information of all the users/sessions that are active/disconnected on the remote machine. We can now reset one of the session with the following command.

reset session [ID] /server:servername

Replace [ID] with the number from the prevoius output and servername with the remote machine name or IP address. This will reset the session and now you can login using Remote Desktop connection.

66 thoughts on “The terminal server has exceeded the maximum number of allowed connections

  1. When I enter “query session /server:XxXxXxXxXxX” in the cmd line on my XP Pro workstation…I receive the following error:

    ‘query’ is not recognized as an internal or external command,
    operable program or batch file.

    Any ideas?


  2. Great suggestions. Just helped me out to remote login to our office’s print server when two of our people were taking up the only connections and were both out of the office.

  3. Great. This sure saved me some time. We have several administrators who always forget to log off. I wont show them this command

  4. Hello There,

    Even I run the command “mstsc /v: /f -console” also getting the session exceeded error message. Pls help me who to overcome this issue.

    • Hari, If it is server 2008 or vista, make sure you use the “/admin” switch instead of “/console”. If you are still unable to connect to the console session, then my guess would be that someone was already logged in to the console session. As I wrote in my post, that if you get disconnected from this console session, you will have to go physically to the machine.

  5. Thanks. It worked a treat.
    Running XP, I opened cmd.exe as a domain admin and then used my local query.exe (not the mapped drive query.exe) to show and reset the sessions.

  6. Thank you! I have had users from several of my clients have this happen and I can’t get in to do the work I was supposed to do. This has save me from many help(less?)desk calls in the future.

    • Windows Server 2003 allows 2 non-console and one console remote desktop connections. You would need to switch the server mode from Remote Administration to Terminal Server, which allows additional client connections. You need appropriate licenses from Microsoft. With XP there are few hacks around to increase this limit.

  7. why after i execute the command for my 2003 server after login my screen goees blank (blue desktop) with no icon, anyone can help me ?

    thank you

  8. I’m using 10 HCL thin clients and getting this error. So where do you want me to put this commands? ON server or on thin clients…….the thin clients doesn’t have the cmd or run options.PLease help me

  9. This may NOT always work, especially on Server 2003:
    mstsc /v: /f -console
    (insert your server’s IP address instead of 000)

    Then use this instead, it WORKS:

    mstsc /v: /f -admin

    When successfully logged in, click on Start, then All Programs, then Administrative Tools, launch Terminal Services Manager
    There find your server on the left, find USERS tab, right-mouse-click on each inactive user (start with highest idle time value) and select DISCONNECT.

    After that LOG OFF.

    For the future try not to simply close RDP (remote desktop client / terminal services client) window when done, but LOG OFF your server.

    Good luck!

  10. I am working on a server 2000 and none of this is working. When I use the query session /server:servername command I get an error

    “Error 5 getting sessionnames
    Error [5]:Access is denied.

    mstsc /v: /f -console
    mstsc /v: /f -admin

    Also does not work. Would you be able to help?


  11. Pingback: Terminal Server: Exceeding the Connection Limit | Anarchy and Acronyms

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s