I Need To Make A Change With My IT Support! Call (225) 706-8414

Remotely Terminate a Remote Desktop Session from the Command Line

You need to connect to a PC using Remote Desktop, but all the available sessions are in use – either by active or disconnected users. So you need to terminate one of those remote RDP sessions, but there is a cache 22 of actually getting into the remote computer to do so.


This is  done from another computer using NET USE and QWINSTA on the command line as a Domain Admin.

  1. Make sure you’re authenticated with remote Windows PC. A simple method is to use NET USE:
    C:> net use /user:Administrator \REMOTEPCC$
  2. Enter in the Administrator password when prompted and press Enter.
  3. In the Command Prompt, run the following command:
    C:> qwinsta /server:REMOTEPC
  4. A list of active and connected Remote Desktop sessions will be displayed. Find the ‘hanging’ connection and its “ID”.
  5. To disconnect and reset the Remote Desktop connection(s) or session(s), use the following command:
    C:> rwinsta ID /server:REMOTEPC
    For example, if you want to reset the session of “accounting_user1” with a session ID of “35” on the “MYDC” server, you would use the following command:
    C:> rwinsta 35 /server:MYDC
  6. With the RDP session ended, you can now connect to the open slot.

qwinsta is short for “Query Window Station”, and rwinsta is short for “Reset Window Station”.


Concerned About Cyber Attacks?


Want to Migrate to the Cloud?

Office 365

Ready to Experience Microsoft Office 365?

Want the latest IT news directly in your inbox? Subscribe now!