Sometimes, you need to kill a remote desktop session on the server remotely. In this article, we will use qwinsta and rwinsta commands to list and kill the remote desktop session on the server.

Get All Remote Desktop Session

You can run the command qwinsta to get all Remote desktop session on the server. For the example, I want to get all session from the server named wowhvdev1. 

qwinsta /server:wowhvdev1
qwinsta

Kill a Remote Desktop Session

After you get all session list from qwinsta command, you can use rwinsta command to kill a session from the server. This command Enables you to reset (delete) a session on a Remote Desktop Session Host (rd Session Host) server. Before we continue, please remember the “ID” that you get from qwinsta command.

rwinsta /server:wowhvdev1 RemoteID

You can replace the RemoteID with the ID that you get from qwinsta command.