Find WMI Classes with PowerShell

by Aug 31, 2012

In a previous tip we showed how Get-WmiObject can search for WMI class names. Some of the returned WMI class names aren't particularly useful, though, because they are used internally. You can improve search results though by excluding any class that has less than 5 properties (which is a rough guess that it is just a linker class without practical use for you). If you are not interested in performance counters, either, you can exclude these, too:

$searchFor = 'disk'

Get-WmiObject -Class "Win32_*$SearchFor*" -List |
  Where-Object { $_.Properties.Count -gt 5 -and $_.Name -notlike '*_Perf*' }

Simply replace the search word in $searchFor with whatever you are looking for. And then, when you know the WMI class name, submit it to Get-WmiObject and omit the -List parameter to get the actual results:

Get-WmiObject -Class Win32_DiskPartition

Twitter This Tip! ReTweet this Tip!