Command Line Hack For: "Terminal Server Has Exceeded The Maximum Number Of Allowed Connections"

Fixing the "Terminal Server Has Exceeded the Maximum Number of Allowed Connections" Error

This error occurs when all available Remote Desktop (RDP) sessions on a Windows Server are already in use. It is often caused by disconnected or idle sessions that were not logged out properly.

Error message:
"The terminal server has exceeded the maximum number of allowed connections. The system cannot log you on."
List active RDP sessions

Use the following command to view all active and disconnected sessions on the server:

query session /server:servername

Replace servername with the server hostname or IP address.

Disconnect a stuck or unused session

Identify the session ID you want to remove, then run:

reset session [ID] /server:servername

This command does not return output, but the session will be immediately disconnected.

Alternative commands

You can also use the legacy commands below:

qwinsta /server:servername
rwinsta [ID] /server:servername
Verify the session was cleared

Run the query command again to confirm the session has been removed:

query session /server:servername
Tip: To prevent this issue, always log out of RDP sessions instead of closing the Remote Desktop window, and consider configuring idle session time limits in Group Policy.
Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 26009

Need more information or have a question ?