Partager via


Win32_PowerPlan class

Represents a power plan on a system. A power plan or scheme consists of a group of power settings and preference information. Each power plan is identified through a unique GUID as well as by a friendly name. Windows power plans also have a personality attribute that indicates the overall power savings behavior of the plan. Multiple power plans can exist; however, each computer can have only a single active power plan in effect at any given time.

A WMI consumer can enumerate all instances of Win32_PowerPlan to get all the power schemes that currently exist on the system. The active Win32_PowerPlan can be obtained by examining the IsActive property on the instance. The Activate method will make the power plan the active plan on the system.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties.

Syntax

[Provider("PowerWmiProvider"), Dynamic]
class Win32_PowerPlan : CIM_SettingData
{
  string  InstanceID;
  string  ElementName;
  string  Description;
  boolean IsActive;
};

Members

The Win32_PowerPlan class has these types of members:

Methods

The Win32_PowerPlan class has these methods.

Method Description
Activate Makes the power scheme the active one on the system.

Properties

The Win32_PowerPlan class has these properties.

Description

Data type: string

Access type: Read-only

Specifies the description of the power plan.

ElementName

Data type: string

Access type: Read-only

Specifies the friendly name of the power plan.

InstanceID

Data type: string

Access type: Read-only

Defines the unique identifier for the power plan instance.

The InstanceID string must be in the following format: "Microsoft:PowerPlan\{Plan_GUID}".

IsActive

Data type: boolean

Access type: Read-only

Indicates whether the power scheme is currently active on the system. This property is set to TRUE if the power scheme is active; otherwise, it is set to FALSE.

Examples

The following PowerShell code example displays the power settings of the local computer.

$powerplan=get-wmiobject -namespace "root\cimv2\power" -class Win32_powerplan | where {$_.IsActive}

$powerSettings = $powerplan.GetRelated("win32_powersettingdataindex") | foreach {
 $powersettingindex = $_;

 $powersettingindex.GetRelated("Win32_powersetting") | select @{Label="Power Setting";Expression={$_.instanceid}},
 @{Label="AC/DC";Expression={$powersettingindex.instanceid.split("\")[2]}},
 @{Label="Summary";Expression={$_.ElementName}},
 @{Label="Description";Expression={$_.description}},
 @{Label="Value";Expression={$powersettingindex.settingindexvalue}}
 }

$powerSettings | ft "AC/DC",Summary,Value -autosize

Requirements

Minimum supported client
Windows 7
Minimum supported server
Windows Server 2008 R2
Namespace
Root\CIMV2\power
MOF
PowerWmiProvider.mof
DLL
PowerWmiProvider.dll