Export (0) Print
Expand All

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.

Enumerating profiles in the root/interop namespace

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

Retrieving instances of a specific device profile

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'}"

Assigning the power profile to a variable

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

Enumerating the power plans on a computer

The following Windows PowerShell command enumerates the available power profile plans:

Calling a method

The following Windows PowerShell command calls the Activate method for the power plan:



$pplan[2].Activate()


Related topics

Cross Namespace Association Traversal
Writing an Association Provider
CIM_RegisteredProfile
Win32_PowerPlan

 

 

Show:
© 2014 Microsoft