List and reset Windows Remote Desktop sessions
List the Remote Desktop sessions on a Windows server and close one with query session and reset session.
On a Windows server with Remote Desktop Services, an administrator can list the sessions open from another computer and close one. The commands below run in a command prompt.
Connect to the server
net use \\<server> /USER:<user>
Avoid typing the password on the command line, where it would remain in the command history.
List sessions
query session /server:<server>
The ID column gives the identifier of each session.
Close a session
reset session <id> /server:<server>
Replace <id> with the identifier shown by query session. The user is disconnected immediately, and unsaved work in that session may be lost.
Notes
- The source note says "kill": the Windows command is
reset session, which is also available under the namelogoff.