Accessing Data in the Interop Namespace
Association providers enable Windows Management Instrumentation (WMI) clients to traverse and retrieve profiles and associated class instances from different namespaces.
Association providers and classes reside in the \\root\interop namespace. For more information, see Cross Namespace Association Traversal and Writing an Association Provider.
Association providers expose standard profiles, like a power profile. The following examples use the power profile to illustrate how to discover and access data through the interop namespace.
Windows PowerShell provides a simple mechanism to traverse through the appropriate association, retrieve a device profile, and call a method.
The following Windows PowerShell command enumerates the Distributed Management Task Force (DMTF)-supported profiles on a Windows 7 computer:
Get-WmiObject CIM_RegisteredProfile -namespace root\interop
The following Windows PowerShell command returns all instances of a specified profile through CIM_RegisteredProfile:
Get-WmiObject -namespace root\interop -query "Associators of {CIM_RegisteredProfile.InstanceID='Power Supply'}"
The following Windows PowerShell command assigns the power profile instance to a variable:
$pplan = Get-WmiObject -query "Select * from Win32_PowerPlan" -Namespace root\cimv2\power
The following Windows PowerShell command enumerates the available power profile plans:
$pplan
The following Windows PowerShell command calls the Activate method for the power plan:
$pplan[2].Activate()