O'Reilly logo

Mastering Windows PowerShell Scripting by Brenton J.W. Blawat

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching for WMI classes

There are instances when you may want to search for different WMI classes on a system. The two primary cmdlets that enable you to search WMI are get-wmiobject, and get-cimclass. You can simply leverage the get-wmiobject cmdlet with the –list argument to list all the classes in a particular namespace. You can further narrow down the list by piping the command to the statement where {$_.Name –like "*Search*"}. This will search the Name property of the classes that match a specific criterion.

An example of using the get-wmiobject cmdlet to find classes with a specific value would look like:

get-wmiobject –list | where{$_.Name –like "*Time*"}

The output of this command is shown in the following screenshot:

The preceding example ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required