End RDP sessions with RWINSTA

Some time ago we already reported about the command to list the RDP information in our article ” RDP information query with QWINSTA ” .

Today we want to show you how to use the command


you can use the existing information and use it to end RDP (Remote Desktop Connections) .

RWINSTA parameters

You can use the integrated help from RWINSTA by calling

rwinsta /?

call. This then looks like this.

rwinsta help

Microsoft describes the ” RWINSTA ” command as follows.

Resets the session subsystem hardware and software to the known original values.

The following parameters are available to you.

RWINSTA parameters Explanation of the parameters
Session name Specifies the session
Session ID Specifies the session ID
/ SERVER: server name Server that contains the session (default is the current server)

You can use the ” / V ” parameter to display other options and options of the RWINSTA command.

End RDP session

To end an RDP session, the RDP session ID is usually sufficient . The RDP session id of about terminating RDP session to get out, you can watch first with qwinsta the current RDP session display.

In our case, we want to end session ID “8”. Then the command to end the RDP session is as follows.

rwinsta 8

Then the following security question appears.

If you reset this session, all users using this protocol will be logged out. Continue process (n = no)?

After answering the question with ” j “, the RDP session is ended and the user is logged off.

Log off RDP sessions remotely

The same, of course, works remotely. You can end a session on another Windows host by specifying the parameter ” / SERVER: Server name “.

rwinsta / SERVER: Server name RDP session ID

Of course, the RDP remote logout only works if you also have the necessary access rights to the server.

A lot of other useful information about “RDP” can also be found in these articles.

– The requested operation could not be carried out because the remote desktop services are currently busy
– Mirror RDP session
– RDP message – A user
account restriction prevents you from logging in – Use and provision of virtual desktops (RDP, VDI and DaaS)
– Change standard RDP port 3389
– Close RDP sessions remotely and call up an overview of all RDP sessions with “quser”
– activate RDP for Windows 10
– switch off drive redirection for RDP session
– restart ( shutdown ) PC with Windows 10 for RDP session
– prevent RDP for local administrators
– Remote desktop connection (RDP) with MSTSC and its parameters
– Activate remote desktop using the registry key – Remote desktop
settings now also in Windows 10 Settings app (Fall Creators Update 1709)
– Run CMD prompt remotely via WINRS