Fix: Terminal Server Max Connections Reached - Command Line

Resolving "Maximum Connections Reached" Errors on Windows Terminal Servers
Administrators of networks utilizing Windows servers frequently encounter the error message: "The terminal server has exceeded the maximum number of allowed connections. The system can not log you on. The system has reached its licensed logon limit. Please try again later."
This issue arises because Windows restricts Remote Terminal Services connections to two when operating in administrative mode. The cause is often either two administrators already connected, or, more commonly, a lingering disconnected session that the system still considers active.
Addressing the Issue Without Domain Access
Resolving this error requires console access to the server if it isn't part of a domain. For servers within a domain, the Terminal Services Manager provides a straightforward method to log off or disconnect problematic sessions.
If direct console access is necessary, or if you prefer command-line solutions, you may need to execute commands from another server, particularly if your local operating system lacks the required utilities.
Ensure you are logged onto the target server with an administrative account before proceeding. A simple method to achieve this is by mapping a network drive.
net use /user:[username] \\servername\share
Identifying Active Sessions
The following command-line utility allows you to determine which sessions are currently connected to the server. You can substitute the server's IP address for its name if preferred.
query session /server:servername
The output will display a list of active sessions, each assigned a unique session ID.
Terminating Problematic Sessions
Once the session ID of the offending session is identified, the reset session command can be used to log off the user.
reset session [ID] /server:servername
For example, if session ID 2 is causing the issue:
This command typically does not produce any visible output. However, re-running the query session command should confirm that the session has been successfully disconnected.
Acknowledgement: This solution was kindly provided by Todd.