query process
Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
Displays information about processes that are running on a Remote Desktop Session Host 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. This command returns the following information:
User who owns the process
Session that owns the process
ID of the session
Name of the process
ID of the process
Syntax
Parameters
Parameter | Description |
---|---|
* | Lists the processes for all sessions. |
Specifies the numeric ID identifying the process that you want to query. | |
Specifies the name of the user whose processes you want to list. | |
Specifies the name of the active session whose processes you want to list. | |
/id: | Specifies the ID of the session whose processes you want to list. |
Specifies the name of the program whose processes you want to query. The .exe extension is required. | |
/server: | 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. |
Remarks
Administrators have full access to all query process functions.
If you don’t specify the , , /id: , , or * parameters, this query displays only the processes that belong to the current user.
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:
To display information about the processes being used by session ID 2, type:
query user query user
Область применения: Windows Server (половина ежегодного канала), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012 Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
Отображает сведения о пользовательских сеансах на удаленный рабочий стол сервере узла сеансов. Displays information about user sessions on a Remote Desktop Session Host server. С помощью этой команды можно определить, вошел ли конкретный пользователь на конкретный сервер узла сеансов удаленный рабочий стол. You can use this command to find out if a specific user is logged on to a specific Remote Desktop Session Host server. Эта команда возвращает приведенные ниже сведения. This command returns the following information:
Имя пользователя Name of the user
Имя сеанса на удаленный рабочий стол сервере узла сеансов Name of the session on the Remote Desktop Session Host server
Идентификатор сеанса Session ID
Состояние сеанса (активно или отключено) State of the session (active or disconnected)
Время простоя (количество минут с момента последнего нажатия клавиши или перемещения мыши в сеансе) Idle time (the number of minutes since the last keystroke or mouse movement at the session)
Дата и время входа пользователя Date and time the user logged on
Чтобы узнать о новых возможностях последней версии, см. статью новые возможности службы удаленных рабочих столов в Windows Server. To find out what’s new in the latest version, see What’s New in Remote Desktop Services in Windows Server.
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
Указывает имя входа пользователя, которому необходимо выполнить запрос. Specifies the logon name of the user that you want to query. | |
Указывает имя сеанса, с которым необходимо выполнить запрос. Specifies the name of the session that you want to query. | |
Указывает идентификатор сеанса, к которому необходимо выполнить запрос. Specifies the ID of the session that you want to query. | |
/server: /server: | Указывает удаленный рабочий стол сервер узла сеансов, к которому требуется выполнить запрос. Specifies the Remote Desktop Session Host server that you want to query. В противном случае используется текущий сервер узла сеансов удаленный рабочий стол. Otherwise, the current Remote Desktop Session Host server is used. Этот параметр является обязательным только при использовании этой команды с удаленного сервера. This parameter is only required if you’re using this command from a remote server. |
/? /? | Отображение справки в командной строке. Displays help at the command prompt. |
Комментарии Remarks
Чтобы использовать эту команду, необходимо иметь разрешение на полный доступ или специальное разрешение доступа. To use this command, you must have Full Control permission or special access permission.
Если вы не укажете пользователя, используя параметры , или SessionID , возвращается список всех пользователей, вошедших в систему на сервере. If you don’t specify a user using the , , or sessionID parameters, a list of all users who are logged on to the server is returned. Кроме того, можно также использовать команду запросить сеанс для вывода списка всех сеансов на сервере. Alternatively, you can also use the query session command to display a list of all sessions on a server.
Когда пользователь запроса возвращает сведения, (>) перед текущим сеансом отображается символ «больше чем». When query user returns information, a greater than (>) symbol is displayed before the current session.
Примеры Examples
Чтобы отобразить сведения обо всех пользователях, вошедших в систему, введите: To display information about all users logged on the system, type:
Чтобы отобразить сведения о пользователе User1 на сервере Server1, введите: To display information about the user USER1 on server Server1, type:
Netdom query
Applies To: Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows 8
Queries the domain for information such as membership and trust.
Netdom is a command-line tool that is built into Windows ServerВ 2008 and Windows ServerВ 2008В R2. It is available if you have the ActiveВ Directory Domain Services (ADВ DS) server role installed. It is also available if you install the ActiveВ Directory Domain Services Tools that are part of the Remote Server Administration Tools (RSAT). For more information, see How to Administer Microsoft Windows Client and Server Computers Locally and Remotely (https://go.microsoft.com/fwlink/?LinkID=177813). To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.
To use netdom, you must run the netdom command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.
For examples of how to use this command, see Examples.
Syntax
Parameters
Specifies the domain to query for the information. If you do not specify this parameter, then netdom query uses the domain to which the current computer belongs.
Specifies the name of the domain controller that performs the query.
Specifies the user account that makes the connection with the domain that you specify in the /d or /domain parameter. If you do not specify this parameter, netdom query uses the current user account.
Specifies the password of the user account that you specify in the /ud or /userd parameter. If you specify the value of this parameter as a wildcard character (*), this parameter prompts you for the password.
Specifies verification of the secure channel secrets for all enumerated memberships or trusts, and then displays them. Only users who are enterprise-level administrators can verify all secure channel secrets.
Specifies resynchronization of the secure channel secrets for all enumerated memberships or trusts that are currently broken. The /reset parameter implies the /verify parameter. Unless the user is an enterprise-level administrator, the user might not be able to reset all enumerated trusts or memberships.
Indicates that the query for trust relationships returns only direct trust relationships, rather than direct and indirect relationships. This parameter is valid only when you specify Domain in the /d parameter.
Specifies the type of list to generate. The following list shows the possible objects:
WORKSTATION: Queries the domain for the list of workstations.
SERVER: Queries the domain for the list of servers.
DC: Queries the domain for the list of domain controllers.
OU: Queries the domain for the list of OUs under which the user that you specify can create a computer object.
PDC: Queries the domain for the current primary domain controller.
FSMO: Queries the domain for the current list of operations master role holders. These role holders are also known as flexible single master operations (FSMO).
TRUST: Queries the domain for the list of its trusts.
Displays help at the command prompt.
Examples
To list all the workstations in the domain Northamerica, type the following command at the command prompt:
To list all the servers in Northamerica, type the following command at the command prompt:
To list all the domain controllers in the domain Northamerica, type the following command at the command prompt:
To list all the OUs in devgroup.example.com, type the following command at the command prompt:
To list the PDC for Northamerica, type the following command at the command prompt:
To list the current PDC emulator for devgroup.example.com, type the following command at the command prompt:
You can use the Query operation with the /verify and /reset parameters to perform the Verify and Reset operations together. You can pipe the output of the Query operation to the netdom Verify or netdom Reset operation.
To list all servers and verify secure channel secret, type the following command at the command prompt:
To list all workstations and reset any unsynchronized secure channel secrets, type the following command at the command prompt:
To list all the direct trust relationships for the domain Northamerica, type the following command at the command prompt:
To list all the direct and indirect trust relationships for the domain Northamerica, type the following command at the command prompt:
To list all trust relationships and check their status, type the following command at the command prompt:
quser
Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
Displays information about user sessions on a Remote Desktop Session Host server. You can use this command to find out if a specific user is logged on to a specific Remote Desktop Session Host server. This command returns the following information:
Name of the user
Name of the session on the Remote Desktop Session Host server
State of the session (active or disconnected)
Idle time (the number of minutes since the last keystroke or mouse movement at the session)
Date and time the user logged on
This command is the same as the query user command. To find out what’s new in the latest version, see What’s New in Remote Desktop Services in Windows Server.
Syntax
Parameters
Parameter | Description |
---|---|
Specifies the logon name of the user that you want to query. | |
Specifies the name of the session that you want to query. | |
Specifies the ID of the session that you want to query. | |
/server: | Specifies the Remote Desktop Session Host server that you want to query. Otherwise, the current Remote Desktop Session Host server is used. This parameter is only required if you’re using this command from a remote server. |
/? | Displays help at the command prompt. |
Remarks
To use this command, you must have Full Control permission or special access permission.
If you don’t specify a user using the , , or sessionID parameters, a list of all users who are logged on to the server is returned. Alternatively, you can also use the query session command to display a list of all sessions on a server.
When quser returns information, a greater than (>) symbol is displayed before the current session.
Examples
To display information about all users logged on the system, type:
To display information about the user USER1 on server Server1, type:
Query command in windows
Starts a new instance of the command interpreter, Cmd.exe. If used without parameters, cmd displays the version and copyright information of the operating system.
Syntax
Parameters
Parameter | Description |
---|---|
/c | Carries out the command specified by string and then stops. |
/k | Carries out the command specified by string and continues. |
/s | Modifies the treatment of string after /c or /k. |
/q | Turns the echo off. |
/d | Disables execution of AutoRun commands. |
/a | Formats internal command output to a pipe or a file as American National Standards Institute (ANSI). |
/u | Formats internal command output to a pipe or a file as Unicode. |
/t: < | > | Sets the background (b) and foreground (f) colors. |
/e:on | Enables command extensions. |
/e:off | Disables commands extensions. |
/f:on | Enables file and directory name completion. |
/f:off | Disables file and directory name completion. |
/v:on | Enables delayed environment variable expansion. |
/v:off | Disables delayed environment variable expansion. |
Specifies the command you want to carry out. | |
/? | Displays help at the command prompt. |
The following table lists valid hexadecimal digits that you can use as the values for and :
Value | Color |
---|---|
0 | Black |
1 | Blue |
2 | Green |
3 | Aqua |
4 | Red |
5 | Purple |
6 | Yellow |
7 | White |
8 | Gray |
9 | Light blue |
a | Light green |
b | Light aqua |
c | Light red |
d | Light purple |
e | Light yellow |
f | Bright white |
Remarks
To use multiple commands for , separate them by the command separator && and enclose them in quotation marks. For example:
If you specify /c or /k, cmd processes, the remainder of string, and the quotation marks are preserved only if all of the following conditions are met:
You don’t also use /s.
You use exactly one set of quotation marks.
You don’t use any special characters within the quotation marks (for example: & ( ) @ ^ | ).
You use one or more white-space characters within the quotation marks.
The string within quotation marks is the name of an executable file.
If the previous conditions aren’t met, string is processed by examining the first character to verify whether it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved.
If you don’t specify /d in string, Cmd.exe looks for the following registry subkeys:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_EXPAND_SZ
If one or both registry subkeys are present, they’re executed before all other variables.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
You can disable command extensions for a particular process by using /e:off. You can enable or disable extensions for all cmd command-line options on a computer or user session by setting the following REG_DWORD values:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD
Set the REG_DWORD value to either 0Г—1 (enabled) or 0Г—0 (disabled) in the registry by using Regedit.exe. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
When you enable command extensions, the following commands are affected:
assoc
call
chdir (cd)
color
del (erase)
endlocal
for
ftype
goto
if
mkdir (md)
popd
prompt
pushd
set
setlocal
shift
start (also includes changes to external command processes)
If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.
File and directory name completion is not enabled by default. You can enable or disable file name completion for a particular process of the cmd command with /f:<on | off>. You can enable or disable file and directory name completion for all processes of the cmd command on a computer or for a user logon session by setting the following REG_DWORD values:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD
To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0Г—9 is TAB and 0Г—08 is BACKSPACE). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
If you enable file and directory name completion by using /f:on, use CTRL+D for directory name completion and CTRL+F for file name completion. To disable a particular completion character in the registry, use the value for white space [0Г—20] because it is not a valid control character.
Pressing CTRL+D or CTRL+F, processes the file and directory name completion. These key combination functions append a wildcard character to string (if one is not present), builds a list of paths that match, and then displays the first matching path.
If none of the paths match, the file and directory name completion function beeps and does not change the display. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. The only difference between the key combinations CTRL+D and CTRL+F is that CTRL+D only matches directory names and CTRL+F matches both file and directory names. If you use file and directory name completion on any of the built-in directory commands (that is, CD, MD, or RD), directory completion is assumed.
File and directory name completion correctly processes file names that contain white space or special characters if you place quotation marks around the matching path.
You must use quotation marks around the following special characters: & [ ] | < >^ = ; ! ‘ + , `
If the information that you supply contains spaces, you must use quotation marks around the text (for example, «Computer Name»).
If you process file and directory name completion from within string, any part of the path to the right of the cursor is discarded (at the point in string where the completion was processed).