Log off a disconnected user remotely

Solution 1:

  1. First, check the session number with qwinsta:

     QWINSTA /server:YOURCOMPUTERNAMEHERE
    

Write down the session ID.

  1. Then use the logoff command:

     LOGOFF YOURSESSIONIDHERE /server:YOURCOMPUTERNAMEHERE
    

See if that works.

[Edit] You can limit the query so it only shows the session id for the user that you want to log off.

In order to do that you the username name to the command, like: QWINSTA /server:YOURCOMPUTERNAMEHERE USER

Solution 2:

Remotely logoff a user by username in one command:

logoff /server:"servername" | qwinsta /server:"servername" "username"

Solution 3:

I believe you can do this with logoff from the command line (assuming the machine you're remoting into is Windows). If I understand your question correctly, a user logs in while you're away from your remote session and logs in under a different account. You will be able to log off from their account via cmd.