404 Tech Support

Use WMI Code Creator to simplify WMI scripting

Windows Management Instrumentation, or WMI, has been mentioned on the site a few times previously. It allows you to get information about a PC from the computer itself. Today, I’m sharing about a free tool provided by Microsoft called WMI Code Creator. You can utilize WMI through the command line or with other languages like VBScript. You can use the WMI Code Creator to automate much of that code writing in VBScript, C#, and Visual Basic® .NET.

WMI Code Creator’s functionality isn’t unique. A previous tool from Microsoft called Scriptomatic used to do the same thing but, as far as I’m aware, hasn’t been updated since 2005 and didn’t work on Windows 7 the last time I tried it. There is also a PowerShell Scriptomatic out there that generates WMI code for PowerShell.

To use WMI Code Creator, you download the program from Microsoft and launch the executable. It’s a portable program with no install needed. When the program runs, you can choose the Namespace and classes you want to operate in. You then select any properties you want to query for their values (Control+Click to select multiple fields). You can run a “Search for Property Values” in order to see what your computer returns and select the value to constrain your search using WHERE conditionals. You can then copy the code, execute it, or send it to Notepad.

There are other tabs that allow you to execute specified methods, receive events, or browse namespaces. The tool is really great because it provides a nice library you can learn how to write the code on your own. You could also adapt it to command line code using WMIC.exe to suit your needs.

You can download WMI Code Creator from http://www.microsoft.com/en-us/download/details.aspx?id=8572