Scroll Top
Evotec Services sp. z o.o., ul. Drozdów 6, Mikołów, 43-190, Poland

Windows – Killing remotely hanging RDP session

You can't log in to RDP session on Windows 2003/Windows 2003 R2 server because you get a message that all sessions are taken, or you simply want to cleanup your RDP sessions from Windows 2008-2012R2 servers.


(Optional) Gain enough privilege to kill RDP connection on the server. This step is optional if you're already logged in with credentials that are valid for multiple sessions (such as domain environment)

net use servername_or_IP /USER:username “password“

List the connection to a particular server and get session ID.

query session /server:servername

Reset the session which you don’t need using ID of the session

reset session ID /server:servername_or_IP
query session /server:TEST2003
SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
console                                     0  Conn    wdcon
rdp-tcp                                 65536  Listen  rdpwd
rdp-tcp#32        server-userid1            1  Active  rdpwd
rdp-tcp#33        server-userid2            2  Active  rdpwd

Related Posts

Leave a comment

You must be logged in to post a comment.