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:[00.00.00.00/SERVERNAME] /f -console

eg: mstsc /v:192.168.1.10 /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

UPDATE:
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.

Advertisements

67 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?

    TIA

  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:158.98.125.251 /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:000.000.000.000 /f -console
    (insert your server’s IP address instead of 000)

    Then use this instead, it WORKS:

    mstsc /v:000.000.000.000 /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:000.000.000.000 /f -console
    mstsc /v:000.000.000.000 /f -admin

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

    Thanks

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

  12. VMware Certified Advanced Professional 6 (Desktop and Mobility Deployment) – The industry-recognized VCAP6-DTM Deploy certification validates that you know how to deploy and optimize VMware Horizon 6 (with View) environments. It demonstrates that you have the understanding and skills necessary to leverage best practices to provide a scalable and reliable Business Mobility platform for your company. Some of the subjects involve: Configuring and managing Horizon View components, configuring cloud pod archituecture, configuring Group Policy settings related to Horizon View, Configuring and optimizing desktop images for Horizon View & Mirage, Configuring and managing App Volumes AppStacks, Configuring desktop pools, Configuring and deploying ThinApp packaged applications, Configuring VMWare Identity Manager, etc.Sebastian’s take on the VCAP6 examination: “In my viewpoint VCAP6 examination is way better experience than VCAP5, the newest examination appears to be exactly like VMware HOL. The interface is not hard, questions are organized on the right area of the display, and can be hidden aside or restored when wanted. My advise on the questions windowpane: if you choose to make it floating, you better know how to restore it back. I ended up shifting it all around merely because I fail to remember how to restore it back. The 2 arrows that looks like control buttons on top were designed to dock the window to right or left. Fonts could be resized, which i believe was considerably better than scrolling down and up the question. The reaction speed of the whole user interface was much faster than VCAP5.5, and there wasn’t any lagging time period experienced when changing from window to window. One thing to remember: BACKSPACE key is not working! I think it is good because you don’t reload your test window by mistake, however, it could be annoying at times whenever you type some thing mistakenly and you have to select and press Del to remove. The Desktop and shortcuts were sorted very effectively, and required applications like browser or Mirage console are easily launched. You will find there’s very good interface for Remote Desktop Manager where you’ll discover all essential RDP connection to servers or desktops without having to type username and password. The web browser had all the links in the Favorite Bar. At the time I’m writing this, there is no additional 30 minute extension for Non-Native English speaker at No-Native English country, which is a bummer. You will find thirty-nine question to answer within the three hours period, and this can be actually really hard for non-native English speakers like me. Quite a few questions take time to complete, so it’s best to by pass the questions that you cannot respond to, and finish those you are able to. After the thirty-nine questions, you’ll be able to go back to the uncompleted questions when you still have time. DO not squander a lot of time on one single question! The examination blue print is found on my weblog at Szumigalski.com. It is well-organized and following it for the exam preparation should help a lot. Surely, the most effective is if you’ll have numerous practical experience! I’m truly very happy with the exam experience, despite the fact that I passed this time by small margin, but I know very well what I missed for the exam, learn from the blunders and practice harder to get familiar myself with the environment. This accreditation could open up your job prospects!”

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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