Getting information for PowerShell scripting – WMI Objects

Recently a customer of mine was watching me script a few things where, among others, I used the Get-WMIObject PowerShell cmdlet… specifically:

Get-WmiObject -Class Win32_Product

His question was how I know to use the Win32_Product class… and what other classes there are which is a question I’m confronted with more and more the last couple of months.

As with most cmdlets, there is a help… when you go through the possible parameters for the Get-WMIObject (and there are quite a few) you will encounter the “-List” parameter:

Get-WMIObject –list

However, this will provide a humongous list! Even that much that a default prompt will only show the last few hundred… and the first few hundred will not be visible anymore, even when you scroll back up.
So… if your object was starting with “Win32_A” you would have to redirect the output to a file and read it from there… or do you? That’s way too much work for such as simple as this, right?

This is where the “-Verb” parameter comes along Glimlach
When you use the following the list will become much, much shorter Emoticon met brede lach

Get-WMIObject –list –verb Win32_A*


But… that’s when you know the name of the parameter, or at least what it begins with. Most of the times you wouldn’t know that. Bedroefde emoticon

So, let’s get a little creative and show all the possible WMI objects with “application” in their name with the following command:

Get-WMIObject –List –Verb *Application*


And this is how you can find the WMI Object you’re looking for…easy, right? Emoticon met brede lach

Leave a Reply

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