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
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.