PowerTip: Use PoweShell to Search for CIM Classes

The Scripting Guys

Dr Scripto

Summary: Learn how to use Windows PowerShell to search for CIM classes.
Hey, Scripting Guy! Question How can I use Windows PowerShell to find a CIM class on my machine?

Hey, Scripting Guy! Answer Use Get-WmiObject in List mode. For instance, to find the class for working with the registry, use:

Get-WmiObject -Namespace root -Class StdRegProv -List –Recurse

     Note If you don’t know where a class can be found, always start at the root.

If you want to find the classes for working with disks:

Get-WmiObject -Namespace root -Class *disk* -List -Recurse

If you know the namespace, you can simplify the search:

Get-WmiObject -Namespace rootcimv2 -Class *disk* -List –Recurse

     Note If you don’t provide a namespace, the default of rootcimv2 is used.

When you find likely classes, use Get-CimClass to investigate details.

The Scripting Guys
Dr Scripto

Follow Dr Scripto   

No Comments.