text
stringlengths
0
4.23k
<programname>
Specifies the name of the program whose processes you want to query. The .exe extension is required.
/server:<servername>
Specifies the Remote Desktop Session Host server whose processes you want to list. If unspecified, the server where you are currently logged on is used.
/?
Displays help at the command prompt.
<processID>
<username>
<sessionname>
<nn>
<programname>
<servername>
Remarks
Administrators have full access to all query process functions.
If you don't specify the <username>, <sessionname>, /id:<nn>, <programname>, or * parameters, this query displays only the processes that belong to the current user.
<nn>
When query process returns information, a greater than (>) symbol is displayed before each process that belongs to the current session.
(>)
Examples
To display information about the processes being used by all sessions, type:
query process *
To display information about the processes being used by session ID 2, type:
query process /ID:2
query session
Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
Displays information about sessions on a Remote Desktop Session Host server. The list includes information not only about active sessions but also about other sessions that the server runs.
Note
To find out what's new in the latest version, see What's New in Remote Desktop Services in Windows Server.
Syntax
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 rd Session Host 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.
<sessionname>
<username>
<sessionID>
<servername>
Remarks
A user can always query the session to which the user is currently logged on. To query other sessions, the user must have special access permission.
If you don't specify a session using the <username>, <sessionname>, or sessionID parameters, this query will display information about all active sessions in the system.
When query session returns information, a greater than (>) symbol is displayed before the current session. For example:
(>)
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