May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Logoff remote desktop sessions via CMD

To List the session in remote server we use quser.exe

Display information about users logged on to the system.

QUSER [username sessionname sessionid] [/SERVER:servername]

username Identifies the username.
sessionname Identifies the session named sessionname.
sessionid Identifies the session with ID sessionid.
/SERVER:servername The server to be queried (default is current).

Example:

C:>quser /server:testserver

USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
A-BalaK ica-tcp#966 10 Active 7 12/25/2010 3:04 PM
GBala ica-tcp#969 1 Active 9 12/25/2010 3:30 PM
Admin ica-tcp#984 5 Active 1:06 12/25/2010 4:33 PM
Finance ica-tcp#987 2 Active 4 12/25/2010 6:20 PM

Logoff the Remote Sessions

To Log off the terminal session of the remote server, Before you log off the remote session, you should know the “Session ID” which you get it from “QUSER” commands as above stated.

1. Logoff
Logoff command kicks off (logging off) the specified remote session. Log off help shows,

C:>logoff /?
Terminates a session.

LOGOFF [sessionname sessionid] [/SERVER:servername] [/V]

sessionname The name of the session.
sessionid The ID of the session.
/SERVER:servername Specifies the Terminal server containing the user
session to log off (default is current).
/V Displays information about the actions performed.

E.g.,

C:>logoff 2 /server:testserver /v
Logging off session ID 2

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>