One thing that seems to come up rather frequently on the newsgroups is what WMI class do I need to use to do X.
The really confusing thing about WMI is knowing just what is available. I have done far more with WMI since discovering PowerShell than I ever did with VBScript. That’s for 2 reasons. Firstly WMI is massively easier to use with PowerShell and it is easier to find out what you need to use.
WMI is arranged in a hierarchy of namespaces. Most of the useful stuff can be found in the default namespace ‘root\cimv2’ We can find out what is available quite easily by using
This will generate a long list of classes. If you have an idea of what you want to look at then we can try something like
which will return all of the classes relating to printers. WMI classes are named fairly sensibly so it is easy to vary the search if you don’t quite get what you need.
Other good ways for discovering WMI – use PowerGUI – it has a WMI browser or download wmiexplorer from http://thepowershellguy.com/blogs/posh/archive/2007/03/22/powershell-wmi-explorer-part-1.aspx
Which ever way you decide to follow to discover WMI – it will be a big part of your PowerShell tool kit.