Query session


Applies To: Windows Server 2008,Windows Vista

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.

Syntax


Copy Code

query session [<SessionName> | <UserName> | <SessionID>] [/server:<ServerName>] [/mode] [/flow] [/connect] [/counter]

Parameters

Parameter

Description

<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.

Remarks


Copy Code

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

The greater 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. The comment following session information is from the session profile. Any sessions in which the initial state is configured as DISABLED do not show up in the query session list until they are enabled.

Examples


Copy Code

query session /server:SERVER2


Copy Code

query session MODEM02

Additional references

Command-Line Syntax Key

Query

Terminal Services Command Reference