
Query session is used to display information about sessions on a terminal server. The list includes information not only about active sessions but about other sessions that the server runs.
Syntax & Parameters
query session [{SessionName|UserName|SessionID}] [/server:ServerName] [/mode] [/flow] [/connect] [/counter]
• SessionName : The name of the session you want to query.
• UserName : The name of the user whose sessions you want to query.
• SessionID : The ID of the session you want to query.
• /server:ServerName : Identifies the terminal server to query. The default is the current server.
• /mode : Displays current line settings.
• /flow : Displays current flow-control settings.
• /connect : Displays current connect settings.
• /counter : Displays current counters information, including the total number of sessions created, disconnected, and reconnected.
• /? : Displays help at the command prompt.
1. To displays information about all active sessions in the system.
C:\>query session SESSIONNAME USERNAME ID STATE TYPE DEVICE >rdp-tcp#968 ITsitiAdmin 0 Active rdpwd rdp-tcp 65536 Listen rdpwd console 2 Conn wdcon rdp-tcp#946 ITsitiAdmin 3 Active rdpwd rdp-tcp#947 ITsitiAdmin 1 Active rdpwd
Additional note:
• The less than (>) symbol indicates the current session.
• SESSIONNAME specifies the name assigned to the session.
• USERNAME indicates the user name of the user connected to the session.
• STATE provides information about the current state of the session.
• TYPE indicates the session type.
• DEVICE, which is not present for the console or network-connected sessions, is the device name assigned to the session.