Export (0) Print
Expand All
26 out of 52 rated this helpful - Rate this topic

wmic

The WMI command-line (WMIC) utility provides a command-line interface for WMI. WMIC is compatible with existing shells and utility commands.

Verbs

To use verbs in WMIC, enter the alias name followed by the verb. If an alias does not support a verb, you receive the message "provider is not capable of the attempted operation." Most aliases support the following verbs.

ASSOC

Returns the result of the Associators of (<wmi_object>) query where <wmi_object> is the path of objects returned by the PATH or CLASS commands. The results are instances associated with the object. When ASSOC is used with an alias, the classes with the class underlying the alias are returned. By default the output is returned in HTML format.

The ASSOC verb has the following switches.

SwitchDescription
/RESULTCLASS:<classname>Returned endpoints associated with the source object must belong to, or be derived from the specified class.
/RESULTROLE:<rolename>Returned endpoints must play a specific role in associations with the source object.
/ASSOCCLASS:<assocclass>Returned endpoints must be associated with the source through the specified class, or one of its derived classes.

 

Example: OS ASSOC

CALL

Executes a method.

Example: SERVICE WHERE CAPTION='TELNET' CALL STARTSERVICE

CREATE

Creates a new instance and sets the property values. CREATE cannot be used to create a new class.

Example: ENVIRONMENT CREATE NAME="TEMP", VARIABLEVALUE="NEW"

DELETE

Deletes the current instance or set of instances. DELETE can be used to delete a class.

Example: PROCESS WHERE NAME="CALC.EXE" DELETE

GET

Retrieve specific property values.

GET has the following switches.

SwitchDescription
/VALUEOutput is formatted with each value listed on a separate line and with the name of the property.
/ALLOutput is formatted as a table.
/TRANSLATE:<translation table>Translate the output using the translation table named by the command. The translation tables BasicXml and NoComma are included with WMIC.
/EVERY:<interval>Repeat the command every <interval> seconds.
/FORMAT:<format specifier>Specifies a key word or XSL file name to format the data.

 

Example: PROCESS GET NAME

LIST

Shows data. LIST is the default verb.

LIST has the following adverbs.

AdverbDescription
BRIEFCore set of the properties.
FULLFull set of properties. This is the default adverb for LIST.
INSTANCEInstance paths only.
STATUSStatus of the objects.
SYSTEMSystem properties.

 

LIST has the following switches.

SwitchDescription
/TRANSLATE:<translation table>Translate the output using the translation table named by the command. The translation tables BasicXml and NoComma are included with WMIC.
/EVERY:<interval>Repeat the command every <interval> seconds.
/FORMAT:<format specifier>Specifies a key word or XSL file name to format the data.

 

Example: PROCESS LIST BRIEF

SET

Assigns values to properties. Example: ENVIRONMENT SET NAME="TEMP", VARIABLEVALUE="NEW"

Switches

Global switches are used to set defaults for the WMIC environment. You can view the current value of the conditions set by these switches by entering the CONTEXT command.

/NAMESPACE

Namespace the alias uses—typically. The default is root\cimv2.

Example: /NAMESPACE:\\root

/ROLE

Namespace WMIC typically looks in for aliases and other WMIC information.

Example: /ROLE:\\root

/NODE

Computer names, comma delimited. All commands are synchronously executed against all computers listed in this value. File names must be prefixed with &. Computer names within a file must be comma delimited or on separate lines.

/IMPLEVEL

Impersonation level.

Example: /IMPLEVEL:Anonymous

/AUTHLEVEL

Authentication level.

Example: /AUTHLEVEL:Pkt

/LOCALE

Locale.

Example: /LOCALE:MS_411

/PRIVILEGES

Enable or disable all privileges.

Example: /PRIVILEGES:ENABLE or /PRIVILEGES:DISABLE

/TRACE

Display the success or failure of all functions used to execute WMIC commands.

Example: /TRACE:ON or /TRACE:OFF

/RECORD

Records all output to an XML file. Output is also displayed at the command prompt.

Example: /RECORD:MyOutput.xml

/INTERACTIVE

Typically, delete commands are confirmed.

Example: /INTERACTIVE:ON or /INTERACTIVE:OFF

/FAILFAST on|off|TimeoutInMilliseconds

If ON the /NODE computers are pinged before sending WMIC commands to them. If a computer does not respond the WMIC commands are not sent to it.

Example: "/FAILFAST:ON" or "/FAILFAST:OFF"

WMIC /FAILFAST:1000

/USER

User name used by WMIC when accessing the /NODE computers or computers specified in the aliases. You are prompted for the password. A user name cannot be used with the local computer.

Example: /USER:JSMITH

/PASSWORD

Password used by WMIC when accessing the /NPDE computers. The password is visible at the command line.

Example: /PASSWORD:password

/OUTPUT

Specifies a mode for all output redirection. Output does not appear at the command line and the destination is cleared before output begins. Valid values are STDOUT, CLIPBOARD or a file name.

Example: /OUTPUT:CLIPBOARD

/APPEND

Specifies a mode for all output redirection. Output does not appear at the command line and the destination is not cleared before output begins and output is appended to the end of the current contents of the destination. Valid values are STDOUT, CLIPBOARD or a file name.

Example: /APPEND:CLIPBOARD

/AGGREGATE

Used with the LIST and GET /EVERY switch. If AGGREGATE is ON, LIST and GET display their results when all computers in the /NODE have either responded or timed out. If AGGREGATE is OFF, LIST and GET display their results as soon as they are received.

Example: /AGGREGATE:OFF or /AGGREGATE:ON

Commands

The following WMIC commands are available at all times.

CLASS

Escape from the default alias mode of WMIC to access classes in the WMI schema directly.

Example: WMIC /OUTPUT:c:\ClassOutput.htm CLASS Win32_SoundDevice

PATH

Escape from the default alias mode of WMIC to access instances in the WMI schema directly.

Example: WMIC /OUTPUT:c:\PathOutput.txt PATH Win32_SoundDevice GET /VALUE

CONTEXT

Display the current values of all global switches.

Example: WMIC CONTEXT

QUIT

Exit from WMIC.

Example: WMIC QUIT

EXIT

Exit from WMIC.

Example: WMIC EXIT

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.