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.
- Make sure you’re authenticated with remote Windows PC. A simple method is to use NET USE:
C:> net use /user:Administrator \REMOTEPCC$
- Enter in the Administrator password when prompted and press Enter.
- In the Command Prompt, run the following command:
C:> qwinsta /server:REMOTEPC
- A list of active and connected Remote Desktop sessions will be displayed. Find the ‘hanging’ connection and its “ID”.
- 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
- 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”.