In this post I will introduce you to a great little tool from Microsoft that can help you getting started creating WMI scripts in C#, Visual Basic or VB script. The tool is free and can help you creating small scripts that can collect data from WMI or execute commands on local or remote computers. Scripting against the WMI namespace you can do a lot of cool stuff like collect information about Operating system or Hardware information. It is also possible to execute commands like reboot or other admin tasks that you might find useful.
What is WMI?
WMI (Windows Management Instrumentation) is a set of extensions to the Windows Driver Model that provides an operating system interface through which instrumented components provide information and notification. With WMI you can find almost any information about your hardware and software on your system.
How to use WMI Code Creator
When you start up WMI Code Creator you can select what scripting language output you want WMI Code Creator to use under the Code Language menu.
Select Namespace and Class
The next thing you want to do is to select the Namespace and the class you want to work with. There are so many classes and properties to choose from and with WMI you can find almost any information about your computer that you would like. In the example below I have chosen the Namespace: root\CIMV2 and the class Win32_OperatingSystem. As you can see it contains 63 properties about the Operating System. I have chosen the property Caption that contains the name of my Operating System.
While I select my properties I want to query the code window on the right automatically update the code based on the options I choose. When you are done you can choose to execute the code from inside the program or open the code in notepad to make your own changes to the script or to copy it to your favorite Script editor.
That was all I wanted to teach you today. I hope you found this post useful and want to check out this tool on your own. I will love if you drop me a comment below and maybe share this post with your friends.