Log off a disconnected user remotely
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 Log Off A Disconnected User Remotely
00:38 Accepted Answer Score 59
01:11 Answer 2 Score 1
01:29 Answer 3 Score 1
02:10 Answer 4 Score 1
03:07 Thank you
--
Full question
https://superuser.com/questions/650816/l...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #remoteaccess
#avk47
ACCEPTED ANSWER
Score 59
First, check the session number with
qwinsta
:QWINSTA /server:YOURCOMPUTERNAMEHERE
Write down the session ID.
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
ANSWER 2
Score 1
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.
ANSWER 3
Score 1
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.)
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.
ANSWER 4
Score 1
If you have PSTOOLS installed, this is SUPER easy. If you do not have PSTOOLS installed, please do so. You may want to copy all of the .exes to your C:\Windows\system32 directory. (in all fairness, if you don't have PS tools and you're a systemadmin... you don't know what you are missing!)
Now, run CMD.exe as an administrator on the local PC, input your admin credentials if/when prompted. Now type "psexec \\hostname cmd.exe" This command will run CMD.exe as your account, remotely, as if you are actually at the machine. In the title bar of the command prompt, you will see the remote host name called out when you have successfully connected.
Now type "query session". this will now print out all the sessions that are available active/inactive, you'll want to note the Session ID #.
now type in "logoff #" where # = the session id you took note of previously.
You could do this with home based network PCs, but you'll have to have the same account on BOTH systems, and it could get a little tricky.
This will DEFINITELY work with domain PCs as I have tested it several times now.