Query process

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Query process

Displays information about processes running on a terminal server. You can use this command to find out which programs a specific user is running, and also which users are running a specific program.

Syntax

query process [{ * | ProcessID | UserName | SessionName | /id:SessionID | Program.exe}] [**/server:**ServerName]

Parameters
  • *
    Lists the processes for all sessions.
  • ProcessID
    Specifies the numeric ID identifying the process you want to query.
  • UserName
    Specifies the name of the user whose processes you want to list.
  • SessionName
    Specifies the name of the session whose processes you want to list.
  • /id: SessionID
    Specifies the ID of the session whose processes you want to list.
  • Program .exe
    Specifies the name of the program whose processes you want to query. The .exe extension is required.
  • /server: ServerName
    Specifies the terminal 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.
Remarks
  • Administrators have full access to all query process functions.

  • If you do not specify the UserName, SessionName, /id:SessionID, Program.exe, or * parameters, query process displays only the processes belonging to the current user.

  • If a session is specified, it must identify an active session. You can use wildcards to identify the process.

  • Query process returns the following information:

    • The user who owns the process

    • The session that owns the process

    • The ID of the session

    • The name of the process

    • The state of the process

    • The ID of the process

  • When query process returns information, a greater than (>) symbol is displayed before each process belonging 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

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command-line reference A-Z
Command shell overview
Terminal Services commands