WMI Command-line Tool

The WMI Command-line (WMIC) tool provides a simple command-line interface to WMI. This allows you to use WMI to manage computers running Microsoft Windows. You can use WMIC from any computer running Windows XP Professional or an operating system in the Windows Server 2003 family to remotely manage any computer with WMI installed. WMIC does not have to be available on the remotely managed computer for WMIC to manage it.

WMIC allows you to:

  • Browse the WMI schemas and query their classes and instances, usually by using aliases that make WMI more intuitive.

  • Work with the local computer, remote computers, or multiple computers by using a single command.

  • Customize aliases and output formats to suit your needs.

  • Create and execute scripts that are based on WMIC.

The WMI infrastructure is accessible as you use WMIC through intermediate facilitators called aliases. Aliases are used to capture the features of a WMI class that are relevant to some specific task, such as disk or network administration. Aliases can be used to provide better names for WMI classes, properties, and methods or to arrange properties in useful output formats. The output formats can include specific property values or be formatted in a manner that is appropriate to some specific presentation strategy or function. For example, an alias might have a BRIEF format that lists only property values that are essential for the identification of the objects visible through the alias. Management data is retrieved in XML format and processed by built-in or custom XSL output formats.

To start WMIC in interactive mode

  1. On the taskbar, click Start, and then click Run.

  2. In the Run dialog box, type WMIC, and then click OK.

    The following appears, where root\cli is the default WMIC role: wmic:root\cli.

  3. At the command prompt, enter an alias, command, or global switch, or enter /? for Help.

  4. When you are done with WMIC in interactive mode, type Exit or Quit, and then press ENTER.

WMIC includes Help at the command line. At any level you can type /? and get additional details. By itself, /? provides the available global switches and the aliases that are available in the current role. When used after an alias, /? provides the verbs and switches available for that alias. After a verb, /? provides the details for that verb.

For example:

wmic:root\cli /?

Provides a list of the syntax and available aliases, including the process alias.

wmic:root\cli process /?

Displays options that are available for the process alias.

For more information about WMIC, see the Windows XP Help or the Help in the Windows Server 2003 family.

To use WMIC with SMS, try commands such as:

wmic:root\cli /namespace:\\root\SMS\site_MSO
wmic:root\cli PATH SMS_Collection
wmic:root\cli PATH SMS_R_System.LastLogonUserName='PTHOMSEN'
wmic:root\cli /namespace:\\root\cimv2

The last line is necessary to return WMIC to its normal namespace, as used in the predefined WMIC aliases.

For More Information

Did you find this information useful? Please send your suggestions and comments about the documentation to smsdocs@microsoft.com.