Windows Server: “The terminal server has exceeded the maximum number of allowed connections”

When working with Windows Server and connecting to a server via Remote Desktop, one might stumble upon the following error message:

Windows Server: The terminal server has exceeded the maximum number of allowed connections

It turns out that even after clicking “OK”, you will not be able to connect to the server and your session will be terminated. But how to fix this problem without physically going to the server?

Here is a screenshot:

Error message stating "The terminal server has exceeded the maximum number of allowed connections"


The reason for this error message is quite simple: A terminal server only accepts a finite number of simultaneous connections. Now, when a user connects to a Windows Server, does his thing and then simply closes the Remote Desktop window, the session on the server is not closed but kept open. So the user will remain logged on.

The correct way to terminate a Remote Desktop session is to select “Start”, then “Log off”. This will close the session and allows other users to connect to the server.

Resolving the problem

To connect to the Terminal Server despite the limited connections, what we can do is to connect to the server with the /admin switch. To do this, launch mstsc as follows:

mstsc /v:n.n.n.n /admin

Replace n.n.n.n with the IP of the server and you’re good to go. Once connected to the server, use Task Manager to log off the sessions that are no longer used. The following screenshot shows that there is one connection that has no current connections and can be logged off:

Windows Task Manager window

To do this, select the session you wish to disconnect (in my case that is the session with the ID 3) and click “Logoff”. Note that this will effectively log off the session and closes all windows still open in that session!

Once these steps have been completed, log your current session off and you should be able to reconnect to the server without using the /admin switch.

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab