How to view and disconnect remote desktop sessions

We might experience this following message prompt” The terminal server has exceeded the maximum number of allowed connections” while RDP’ing the remote windows machine.

This message appears due to the utilization of maximum number of allowed remote login sessions i.e. it may happen due to inactive user sessions, this will be annoying if you are performing some critical tasks in the server.

The simplest way to resolve is by disconnecting the inactive user sessions in the remote computer by using the below mentioned commands.


The following procedure requires domain admin access or the local administrator account of the target remote computer

Command to view the Remote desktop user sessions:

Open elevated command prompt [CMD] and type the following command to find the logged on users

qwinsta /server: server name

Where server name is the name of your machine or IP Address of the remote machine.


The output will display the user details along with the session ID and state based on which it’s easy for us to find the inactive user sessions.

Command to disconnect the Remote desktop user sessions:

Followed by the above mentioned command we should keep note of the user’s session ID to disconnect the session.

In the same elevated command prompt [CMD] window, type the below command followed by session ID that’s displayed in the above command to disconnect the user session

rwinsta /server: server_name session_ID


If you face any issue in following the same or if you have any other tips, feel free to let us know via comments session below.