February 2nd, 2015

PowerTip: Use PoweShell to Search for CIM Classes

Doctor Scripto
Scripter

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.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.