WMIC.exe – Windows CMD Command

Windows Management Instrumentation Command.
Retrieve a huge range of information about local or remote computers. Make configuration changes to multiple remote machines.

The ALIAS defines the component of your system that you want WMIC to interact with.
The WHERE clause can be added to filter down to a specific item, e.g. a specific printer instead of all printers.

Options

By default an alias will return a standard LIST of information, you can also use GET to return one or more specific properties.

GET * will also return all properties.

Configuration changes can be made, where indicated above with: [CALL or SET ]

The CREATE and DELETE options allow you to change the WMI schema itself.

The order of the /FORMAT and /TRANSLATE switches is significant: if /TRANSLATE follows /FORMAT, the output is formatted first and then translated.

Where

The options above can be filtered with a WHERE clause:

Where item=’string value‘ # Test if Equal
Where item!=’string value‘ # NOT EQUAL

Use single quotes to delimit spaces or special characters, do not add spaces to either side of the = or !=
See further examples below.

Format:

Format defines the layout of the information, XML output is automatically formatted using a default style sheet, while other formats (HTML, Table, MOF, Raw XML etc) can be specified using /FORMAT: stylesheet_name

Stylesheets supplied with WMIC:

All output files are unicode text (convert to ASCII with TYPE) Tab Separated Values (.tsv) can be opened in excel

The PROCESS alias can be used to start a new installation process, if doing this across the network, place the installer files on a share with permissions EVERYONE : Read Only. This is because network credentials will be dropped when jumping from one remote machine to another (unless you have kerberos configured).

Notes

To run WMIC requires administrator rights and for many operations Elevation.

The last element returned by WMIC is a single <CR> character (an empty line), when running WMIC in a FOR loop you might need to remove this, particularly if delayed expansion is involved.

The number of WMI properties that can be monitored has increased with every new version of Windows.

Running WMIC within a batch file it can sometimes hang, possible workarounds for this:
START “” /W CMD /C WMIC options
WMIC options… <NUL

The WMI information for installed software packages (PACKAGE and SOFTWAREFEATURE) is often incomplete and inconsistent for a variety of historical reasons. A more reliable method is to retrieve a list of installed programs directly from the Add/Remove list in the registry, with a VBScript like this from Torgeir Bakken.

You may also like...

5 Responses

  1. 0mniartist says:

    Nice respond in return of this issue with solid arguments and explaining all regarding that.
    asmr 0mniartist

  2. 0mniartist says:

    Wow! This blog looks just like my old one! It’s on a completely different topic but it has pretty much the same page layout and design. Outstanding
    choice of colors! asmr 0mniartist

  3. 0mniartist says:

    Nice post. I learn something new and challenging on sites I stumbleupon every day.
    It will always be helpful to read through articles from other writers and practice
    a little something from other websites. 0mniartist asmr

  4. 0mniartist says:

    Thanks for sharing your thoughts about 0mniartist. Regards asmr
    0mniartist

  5. 0mniartist says:

    I am actually glad to read this weblog posts which contains plenty of useful information,
    thanks for providing such statistics. 0mniartist asmr

Leave a Reply

Your email address will not be published. Required fields are marked *