Remotely Log Off Users
I frequently use Remote Desktop, especially when I'm at home and need to access my desktop at work. Nothing stinks more than logging in, only to see this:
This happens because Windows by default only allows two simultaneous terminal services connections to the same machine. Usually one is my console user, but at various times other people remote into my machine to grab things, and don’t explicitly log out of machines when they disconnect from remote desktop which causes their sessions to remain active.
First, how can we query to find out what users have a session on a remote machine? Windows provides the qwinsta.exe command which we can use to query for the sessions that are running The format is as follows (from a command screen, of course, so go to Start | Run | cmd - and you must be an administrator on the target machine - for instance I'm an admin on the 10.1.2.230 box):
qwinsta /server:
So, in my case it's qwinsta (or quser works as well) /server:10.1.2.230
It shows the user and the session ID, and quser shows the idle time as well (which is handy for determining who to boot).
Now that we know what users are on a machine, the next step is exercising those Administrator functions, and kicking them off. The command is logoff.exe.
logoff/server:
So for mine, it was logoff 1 /server:10.1.2.230. That kicked Nate off my box, and allowed me to remote in.
WARNING BEFORE YOU DO THIS:
If you log someone off, whatever they had open or whatever they were doing is lost. Be prepared for angry people, unless you're really sure they're idle or done...
No comments:
Post a Comment