PowerTip: Use CIM Cmdlets to Find WMI Classes

Summary: Use the CIM cmdlets in Windows PowerShell to find associated WMI classes.

Hey, Scripting Guy! Question How can I find the associated classes for a WMI object?

Hey, Scripting Guy! Answer Use the Windows PowerShell 3.0 CIM cmdlets.

First get the WMI object for which you want find the associated classes:

$group = Get-CimInstance -ClassName Win32_Group  -Filter “Name = ‘Administrators'”

Then find the associated classes:

Get-CimAssociatedInstance -InputObject $group | select CimClass –Unique

Then choose and use the class you need:

Get-CimAssociatedInstance -InputObject $group -ResultClassName Win32_UserAccount