WMIC: Leveraging the power of WMI

The Windows Management Instrumentation Command-Line (WMIC) provides administrators easy access to the WMI infrastructure.  Prior to the WMIC, you could only access the management infrastructure via the providers or an API.  Since the ultimate goal of WMI is to make life easier for system and application administrators, this obviously presented a problem. The WMIC environment […]

The Windows Management Instrumentation Command-Line (WMIC) provides administrators easy access to the WMI infrastructure.  Prior to the WMIC, you could only access the management infrastructure via the providers or an API.  Since the ultimate goal of WMI is to make life easier for system and application administrators, this obviously presented a problem.

The WMIC environment allows interactive queries or scripting.  It is interoperable with existing shell and utility commands and can be extended by scripts and other administration-oriented applications.  WMIC is included with Windows XP and later operating systems.  However, since WMIC works locally and remotely, it is possible to run WMIC commands against Windows 2000 systems remotely so long as the particular action is supported by WMI on the target machine.  Beyond the ability to use WMIC against local and remote systems, there are other significant benefits:

  • WMIC leverages existing OS WMI providers and can leverage additional providers that are added to the system
  • WMIC can generate output in multiple formats such as .TXT, .CSV, .HTML and .XML
  • WMIC has very powerful functionality natively available, however it is an extensible tool

So that should be enough of the marketing fluff around WMIC.  How exactly do you use it?  There are two modes of use for WMIC – Interactive or Scripting.  In Interactive mode, WMIC provides and ‘environment’ for scripting.  The environment allows you to enter commands and view the results in the immediate display – just like the standard command line interface you are accustomed to.  The Interactive environment also allows the use of the discoverable help which is context sensitive.  In the screenshots below, you can see the WMIC Interactive environment, which is launched by running WMIC from a command prompt, followed by examples of the help features[…]

Full Article

Additional Resources:

WMIC, Windows, Management, Knowledgebase, WMI, Guide