Поделиться через


WMIC verbs

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

WMIC Verbs

Most aliases support the following verbs. Aliases might also support other verbs. To use verbs in WMIC, enter the alias name followed by the verb. For more information about <alias> /?, see "Aliases" in Help. If an alias does not support a verb, you receive the message "provider is not capable of the attempted operation."

Verb Action Parameters or Verb-specific switches Example

ASSOC

Returns the result of the query: Associators of {<wmi object>} 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 associated with the class underlying the alias are returned. By default, the output for class is in TABLE format. See the following table of switches for /ASSOC.

Optionally, an output file format, such as LIST, MOF, or other.

OS ASSOC

CALL

Executes methods.

Method and parameter list if appropriate. Parameter lists are comma delimited. Use SERVICE CALL /? to get a list of available methods and their parameters for the current alias.

SERVICE WHERE CAPTION='TELNET' CALL STARTSERVICE

CREATE

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

Properties equated to values, delimited with commas. Use CREATE /? for a list of property names for the alias.

ENVIRONMENT CREATE Name="WMIC_test",VariableValue="WMIC_test_value",UserName="SYSTEM"

DELETE

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

/INTERACTIVE (prompt to confirm) or /NOINTERACTIVE (do not prompt to confirm).

PROCESS WHERE NAME="CALC.EXE" DELETE

GET

Get specific properties.

Property name or switch. See the table of switches for /GET below. Also use GET /? for a list of property names and switches for the alias.

PROCESS GET NAME

LIST

Show data. LIST is the default verb.

See the following tables of adverbs and switches for LIST.

PROCESS LIST BRIEF

SET

Property set operations.

Properties equated to values, delimited with commas. Use SET /? for a list of property names for the alias.

ENVIRONMENT WHERE Name="WMIC_test" SET VariableValue="WMIC_test_value1"

The List verb has the following adverbs. To use adverbs in WMIC, enter the alias name followed by a verb and adverb. For more information about <alias> /?, see "Aliases" in Help.

Adverb Results

BRIEF

A core set of the properties.

FULL

The full set of properties. This is the default set of LIST properties.

INSTANCE

The instance paths only.

STATUS

The status and related properties of the object.

SYSTEM

System properties.

Alias-specific or user format

Alias-specific or user defined formats might be defined by providing distinct lists of properties and a format to be used in displaying them.

WRITEABLE

The writeable properties of the objects.

The List verb has the following switches. To use verb-specific switches in WMIC, enter the alias name followed by a switch (verbs and adverbs might also be used). For more information about <alias> /?, see "Aliases" in Help.

Switch Effect

/TRANSLATE:<translation table>

Translate the output using the translation table named by the command. BasicXml and NoComma are translation tables included with WMIC.

/EVERY:<interval>

Repeat the command every X seconds; X is determined by the interval.

/FORMAT:<format specifier>

Specify a keyword or XSL file name to format the data, as explained in the following note.

The Get verb has the following switches.

Switch Effect

/VALUE

The output is formatted with each value listed on a separate line and with the name of the property.

/ALL

The output is formatted as a table. The default output format is /ALL.

/TRANSLATE:<translation table>

Translate the output using the translation table named by the command. BasicXml and NoComma are translation tables included with WMIC.

/EVERY:<interval>

Return values every X seconds, X is the interval.

/FORMAT:<format specifier>

Specify a keyword or an XSL file name to format the data, as explained in the following note.

The Assoc verb has the following switches.

Switch Effect

/RESULTCLASS:<classname>

The returned endpoints associated with the source object must belong to or be derived from the specified class.

/RESULTROLE:<rolename>

The returned endpoints must play a particular role in their association with the source object.

/ASSOCCLASS:<assocclass>

The returned endpoints must be associated with the source through the specified class or one of its derived classes.

Notes

  • For both the LIST and GET verbs, the format specifier is used to designate either the name of an XSL file or the standard formats TABLE or LIST. /FORMAT:TABLE is equivalent to /ALL, which is the default output format.

  • MOF-formatted output can be captured to a file (using the /RECORD switch) and the file can be compiled using Mofcomp.exe on another computer to import it into WMI on the other system. However, make sure that computer-specific properties are edited as appropriate for the other computer.

  • The order of the /FORMAT and /TRANSLATE switches is important. If /TRANSLATE follows /FORMAT, the output is formatted and then translated. If /FORMAT follows /TRANSLATE, the output is translated and then formatted.

Examples

The following examples demonstrate the effective use of the verbs and their adverbs and switches.

  • PROCESS GET NAME /FORMAT:XML.XSL /TRANSLATE:BASICXML

    The process names are output in XML format. Without the /TRANSLATE switch, the characters around the values are displayed as their HTML equivalents.

  • PROCESS WHERE Handle="0" ASSOC

    The instances associated with a specific object (unlike the classes associated with an alias) are returned.

For information about WMI security, see Managing WMI security.

For information about WMIC security, authentication, and authorization, see Security with WMIC.

For more information, see Windows Management Instrumentation Command-line.