Updated: September 28, 2007
Displays information about sessions on a terminal server.
The list includes information not only about active sessions but also about other sessions that the server runs.
For examples of how to use this command, see Examples.
query session [<SessionName> | <UserName> | <SessionID>] [/server:<ServerName>] [/mode] [/flow] [/connect] [/counter]
<SessionName>
Specifies the name of the session that you want to query.
<UserName>
Specifies the name of the user whose sessions you want to query.
<SessionID>
Specifies the ID of the session that 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.
C:\>query session SESSIONNAME USERNAME ID STATE TYPE DEVICE >console Administrator1 0 active wdcon rdp-tcp#1 User1 1 active wdtshare rdp-tcp 2 listen wdtshare 4 idle 5 idle
query session /server:SERVER2
query session MODEM02
Command-Line Syntax Key
Query
Terminal Services Command Reference