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 ...
Get Mastering Windows PowerShell Scripting now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.