Close RDP sessions remotely and call up an overview of all RDP sessions with “quser”

If you work a lot with RDP (Remote Desktop Protocol) , you may be familiar with the problem that after a certain number of active RDP sessions, no further RDP sessions can be established with the Windows server or Windows client. The user who tries this can then receive the following message.

Force disconnect RDP for this user

The exact message is:

Select a user you want to disconnect from so that you can log in. Too many users are logged on.  

Here the user can now force a specific active RDP session and thus gain access to the remote system via RDP.

List and separate RDP sessions using the QUSER command

However, there is also another option for reading out RDP sessions of a remote system using a command line command and separating them. The necessary command is part of the standard scope of every Windows client and server version and is called

QUSER

With the following command you can then query the active RDP sessions remotely

QUSER / SERVER: SERVERNAME

Below we have given you an example of this. This query shows that 4 RDP sessions are registered on the remote server.

quser server

Now you have the choice which RDP session you want to end remotely. This then works with the following command

LOGOFF SESSION-ID / SERVER: SERVERNAME

Below you can see the entire process in a command prompt.

logoff sessionid remote server

After you have ended the session with ” logoff “, you can check the RDP sessions again with the “QUSER” command . In this example, the last RDP session due to the remote end has disappeared from the RDP list.

ATTENTION: Of course, these two commands only work if the command prompt has the necessary rights for the remote system. 

You can find more RDP information in these articles:

– Activate RDP in Windows 10
– Disable drive redirection in RDP session
– Restart PC with Windows 10 in RDP session ( shutdown )
– Prevent RDP for local administrators
– Remote desktop connection (RDP) with MSTSC and its parameters
– Activate remote desktop with registry key
– Remote desktop settings now also in Windows 10 Settings app (Fall Creators Update 1709)
– Run CMD prompt remotely via WINRS

 

administrator