How to parse WMIC output with Python

By | March 18, 2016

The Windows Management Instrumentation Command-line (WMIC) is a command-line and scripting interface for Windows Management Instrumentation (WMI).

For example, if you are interested in getting Caption, Description, and Vendor of Python installed. Simply run the following command.

The output will be similar to below:

The first line is the headers, and is followed by one or more entries. The following function can parse the output and store the result as a list of dict.

To try out the function, start Python console and run the following code.

Leave a Reply

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