Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I log a disconnected user off remotely?

For example, I remotely connect to a computer (with Dameware, if that matters) and run a command that takes a significant amount of time to complete. In that time I move on to other things. When I come back, (the command has presumably completed successfully) another user has switched to their account, leaving my account status as "Disconnected". How can I remotely log off my account without having to take control of the computer, switch to my account, log off, and have the user log in again?

share|improve this question
    
Can't you make a .bat with the command? Run the command, then logoff? –  Luiz Angelo Sep 27 '13 at 11:57

3 Answers 3

up vote 2 down vote accepted

First, check the session number with qwinsta:

QWINSTA /server:computername

Write down the session ID.

Then use the logoff command:

LOGOFF sessionID /server:computername.

See if that works.

share|improve this answer
    
QWINSTA gives me Error 5 getting sessionnames Error [5]:Access is denied. even though I am a local admin on the machine. –  thePurpleMonkey Sep 26 '13 at 21:37
    
@thePurpleMonkey If this is a domain computer, you need to be the domain admin. If this is a personal computer, you may need to have exact same username on both PC (and both admin) and run the command from Luiz. qwinsta will attempt to connect using the 'current' credentials which may not have access on the remote computer. –  Darius Sep 27 '13 at 5:40
    
@Darius you don't actually need to be the domain admin. I'm not one in my network and I can qwinsta machines without a problem. But the info is valuable none the less. Is it a domain machine or not? –  Luiz Angelo Sep 27 '13 at 11:56
    
@Darius @Luiz Both my computer and the target computer are on the domain. I am not a domain admin, but I am a local admin nonetheless. I tried using the default credentials, and also specifying domain\username, neither of which worked. I can run qwinsta on my own machine, but if I try on any other computer, it fails. –  thePurpleMonkey Sep 28 '13 at 6:06
    
Welkl, if it fails I guess it's something related to the firewall. Have you check if the remote server acceps RPC calls? –  Luiz Angelo Sep 28 '13 at 13:39

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.

share|improve this answer

For most versions of Windows: Log in to the system using an admin-enabled account. Bring up the task manager ("Windows Security" under the Start button if you RDP, "taskmgr.exe" from the command line, or any other way you prefer.) Go back to the "Users" tab. You'll see your own session & any other sessions. Select the other user's session and right-click, then choose Disconnect or Logoff (or, you can select the session and use the buttons at the bottom to do either of these.)

image of User tab in task manager

If it is a disconnected session, you can also select it, right-click, and use Connect -- this will switch you into that session instead of the one you're in. Then, of course, you can log out the session.

share|improve this answer
    
Ideally, I wouldn't want to affect the user of the computer by taking over their computer. Thanks, though. –  thePurpleMonkey Sep 28 '13 at 6:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.