Logoff Remote Desktop Sessions from the Command Line

Here’s an easy way to view RDP sessions for other servers from the command line and log them off if you need to. The only requirement for this is that you are a domain admin.

From an elevated command prompt, run the below the command, replacing <server> with the hostname or FQDN of the server you want to view the sessions of.

qwinsta /server:<servername>

This will show you a list of all sessions logged into that server.

If you want to logoff one of these sessions, run the below the command replacing <session ID> with the session ID which you want to logoff, which is shown in the above command.

logoff /server:<servername> <session ID> /v

This will then log off the session.

Hope this helps!

About the author