You can run the following commands to easily kill any remote sessions to a command prompt from a Windows Operating System (tested from Windows XP to Windows 10 and from Windows Server 2003 to Windows Server 2016), using Qwinsta & Rwinsta binary executable files under C:\WINDOWS\system32.
qwinsta.exe – Displays information about sessions on a terminal server and is same as the query session command.
rwinsta.exe – Resets sessions on a terminal server and is same as the reset session command.
Here the Instructions:
- Open windows command prompt
- to view current connections: qwinsta /server:myterminalserver
This results in an output of
SESSIONNAME USERNAME ID STATE TYPE DEVICE
console administrator 0 Active wdcon
rdp-tcp 65536 Listen rdpwd
rdp-tcp#51 administrator 2 Active rdpwd
- kill a session by: rwinsta [sessionID] /server:myterminalserver
i.e. rwinsta 2 /server:myterminalserver
replace “myteminalserver” with your servername or ip address.