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."
"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:servernameReplace 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:servernameThis 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:servernameVerify the session was cleared
Run the query command again to confirm the session has been removed:
query session /server:servernameTip: 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.