Microsoft KB Archive/186592

= Terminal Server Commands: QUERY =

Article ID: 186592

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Windows NT Server 4.0, Terminal Server Edition
 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server

-



This article was previously published under Q186592



SUMMARY
QUERY replaces QUSER, QPROCESS, QOBJECT, QAPPSERV, QWINSTA from Citrix Winframe.

The query utilities are used to display current information about the system such as the current allocation of resources and system status. The query command can invoke any one of the query utilities. The command line format is: query [appservers | object | process | session | user] [/?] /? (help)

Displays the syntax for the command and information about the command's options.

Syntax
Query Appservers:

Displays the available application servers on the network.

Query appservers [servername] [/domain:domainname] [/address] [/continue] [/?]

Parameters
servername

Identifies an application server.

/domain:domainname

Displays application server information for the specified domainname. Defaults to the current domain.

/address

Displays the network and node addresses for each server.

/continue

Pauses after each screen of information until a key is pressed.

/? (help)

Displays the syntax for the command and information about the command's options.

Query Appservers -- Additional Notes
Query Appservers searches the network for all attached application servers and returns the following information:

The servername. The network and node address (if the /address option is used).

The following is an example for query appservers:   C:\>query appserversAPPLICATION SERVERfast_eddieengineeringaccess_1 *brand_x The asterisk (*) indicates the current servername. APPLICATION SERVER identifies the servername.

Query Appservers -- Examples
To display information about all application servers found on the network, type:

query appservers

To display information about the fasteddie application server, type:

query appservers fasteddie

To display information about all application servers in domain SYSTEM, type:

query appservers /domain:system

To display the network and node address for the NABBY application server, type:

query appservers NABBY /address

Syntax
Query Object:

Displays information about the system's Object Manager Namespace.

query object [Objectname] [/device] [/?]

Parameters
Objectname

Identifies the object type to query.

/device

Displays devices in the \DosDevices namespace in a modified format.

/? (help)

Displays the syntax for the command and information about the command's options.

Query Object -- Examples
To display information about the objects that are in the \Driver namespace, type:

query object \Driver

To display information about the objects that are in the \DosDevices namespace in a modified format, type:

query object /device

Syntax
Query Process:

Displays information about processes.

query process [processID] [/server:servername] [/system] [/?]

query process[username] [/server:servername] [/system] [/?]

query process[sessionname] [/server:servername] [/system] [/?]

query process[/ID:sessionID] [/server:servername] [/system] [/?]

query process[programname] [/server:servername] [/system] [/?]

query process[*] [/system] [/server:servername] [/?]

Parameters
processID

Identifies a process.

username

Identifies the name of the user whose processes you want to display.

sessionname

Identifies the name of the session. The name was created by the system administrator when the session was configured.

/ID:sessionID

Identifies the session whose processes you want to display.

programname

Identifies the name of the program whose processes you want to display. The .exe extension is required.

/server:servername

The Terminal Server to be queried. Otherwise, the current Terminal Server is used.

/system

Displays process information for system processes.

/? (help)

Displays the syntax for the command and information about the command's options.

Security Restrictions
Query process is used to query only those processes belonging to the current user, unless the current user has sufficient security classification to query processes belonging to other users. Administrators have full access to all query process functions.

Query Process -- Additional Notes
If no process or session is specified, query process queries all 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. If a single wildcard is present (*), all processes in the system are identified.

Query process returns the following information:  The user that owns the process. The session that owns the process. The ID of the session. The process name. The process state. The ID of the process. The following is an example for query process:   C:>query process USERNAME SESSION ID STATE PID >edj rdp-tcp#002 0 wait 353 progman.exe >edj rdp-tcp#002 0 wait 49 cmd.exe >edj rdp-tcp#002 0 wait 139 query.exe >edj rdp-tcp#002 0 run 375 qprocess.exe The > character identifies the current user. Session identifies the session where the user is logged on the system. ID specifies the ID of the session.

State indicates the state of the process. PID identifies the processID of the program that follows.

Query Process -- Examples
To display information about process 8, type:

query process 8

To display information about all processes for user EDDIEJ, type:

query process EDDIEJ

To display information about all processes in session rdp-tcp#002, type:

query process rdp-tcp#002

To display information about all processes in session 4, type:

query process /id:4

To display information about the process Netclient.exe, type:

query process Netclient.exe

To display information about all processes in the system, type:

query process *

To displays information about all processes on the system, including system processes, type:

query process * /system

Syntax
Query Session:

Displays information about sessions.

Query session [sessionname] [/server:servername] [/mode] [/flow] [/connect] [/?]

Query session[username] [/server:servername] [/mode] [/flow] [/connect] [/?]

Query session[sessionID] [/server:servername] [/mode] [/flow] [/connect] [/?]

Parameters
sessionname

Identifies the name of the session. The name was created by the system administrator when the session was configured.

username

Identifies the user of the session.

sessionID

Specifies the ID of the session.

/server:servername

The Terminal Server to be queried. Otherwise, the current Terminal Server is used.

/mode (session mode)

Displays the current line settings.

/flow (flow control)

Displays the current flow control settings.

/connect (connect settings)

Displays the current connect settings.

/? (help)

Displays the syntax for the command and information about the command's options.

Security Restrictions
A user can always query the session where the user is currently logged on. The user must have Query Information access permission to query other sessions.

Query Session -- Additional Notes
If no session is specified, query session displays all active sessions in the system. Otherwise, the session must identify an active session.

The following is an example for query session:   C:>query session SESSION USERNAME ID STATE TYPE DEVICE >console administrator 0 active rdp-tcp#003 eddiej 1 active rdp-tcp 2 listen rdp-tcp 3 listen rdp-tcp 4 idle 5 idle The > character identifies the current session. Session specifies the session name. Username identifies the name of the user connected at the session, if any. ID identifies the ID of the session connected to the system, if any. State provides information on the current state of the session and can be any of the following:   Active. The session is connected and active. Conn. The session is connected. No user is logged on. ConnQ. The session is in the process of connecting. If this state continues, it indicates a problem with the connection. Shadow. The session is shadowing another session. Listen. The session is ready to accept a client connection. Disc. The session is disconnected. Idle. The session is initialized. Down. The session is down, indicating the session failed to initialize correctly. Init. The session is initializing. Type indicates the session type. Device is the device name assigned to the session (not present for the console or network-connected sessions). The comment following the session information is from the profile.

A session initially configured as disabled does not show up in the query session list until it is enabled.

Query Session -- Examples
To display information about all active sessions on server ACCTG, type:

query session /server:ACCTG

To display information about session MODEM02, if it is active, type:

query session MODEM02

Syntax
Query User:

Displays information about users who are logged on the system.

query user [username] [/server:servername] [/?]

query user[sessionname] [/server:servername] [/?]

query user[sessionID] [/server:servername] [/?]

Parameters
username

Identifies the user.

sessionname

Identifies the name of the session. The name was created by the system administrator when the session was configured.

sessionID

Specifies the ID of the session.

/server:servername

The Terminal Server to be queried. Otherwise, the current Terminal Server is used.

/? (help)

Displays the syntax for the command and information about the command's options.

Security Restrictions
A user must have Query Information access permission to query other users.

Query User -- Additional Notes
Displays information about users who are logged on the system. Users who are not logged on the system are not included.

If no user or session is specified, query user displays all users who are logged on the system. The session must identify an active session.

Query user returns the following information:   The name of the user The name of the session The ID that identifies the session The state of the session (active or disconnected) The idle time-the time since a keystroke or mouse movement was received at the session The logon time, when the user logged on the system The following is an example for query user:   C:\>query user USERNAME SESSION ID STATE IDLE TIME LOGON TIME admin console 0 active 55 10/07/94 17:30 >edj rdp-tcp#004 4 active 10/10/94 09:03

The > character indicates the current user. Username identifies the user. Session identifies the session where the user is logged on the system. ID identifies the session. Idle time is a measure of interaction between the user and the system by indicating the time in minutes since the last keystroke or mouse movement. A dot (.) indicates that the time is less than a minute. Logon time is the time when the user logged on the system.

Query User -- Examples
To display information about all users logged on the system, type:

query user

To display information about the user EDJ on server WF06, type:

query user EDJ /server:WF06

To display information about the user at session rdp-tcp#001, type:

query user rdp-tcp#001

Keywords: kbinfo KB186592

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.