Partilhar via


Query Sessions on a Remote Server . . .

Ever get the feeling someone logged onto a server or desktop without logging off properly? If your a big fan of command line and not so of the GUI, try using these two commands below to log someone off. To determine who is logged in type the command below:

Query Session Server:%ServerName%

The output you receive will look like this:

SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
rdp-tcp#0 %username% 1 Active rdpwd
console 3 Conn

Now you can then determine from the screen above what session can be logged off (as long as you are an administrator on the machine). I always ask if I can log them off before doing so, they might be running a long task. To log someone off of their remote session simply configure the command below using the ID # and Session Name above:

logoff [{SessionID | SessionName}] [/server:ServerName] [/v]