customer relationships

How to Logoff Remote Desktop Sessions from the Command Line

It’s happened to all of us. You try to logon to an administrative remote desktop on a server, but you can’t because both administrative RDP sessions are in use. Oftentimes this is because other admins have simply disconnected their remote desktop session, rather than logoff as they should.

Here’s a simple way to determine which sessions are logged on and how to log one or more of them off remotely from the command line. These procedures assume you are running them as a Domain Admin.
  • From an elevated CMD prompt, type the following command to find out who is logged on:

qwinsta /server:<servername>

The output will show who’s logged on to the console (if anyone) and the various RDP sessions in use. It also displays the session ID, which is important for the next command.

Output from quinsta /server:<servername>
  • Next, run the LOGOFF command, specifying the server and session ID you want to logoff:

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

logoff /server:<servername>

This will logoff the remote session you specified. Note that if there are any open files in the remote desktop session, changes to that data may be lost.


Got a project that needs expert IT support?

From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.

Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!

CONTACT US NOW
one click social media designs