Partager via


Win32_PowerSetting class

Represents a power setting on the system. A power setting is a setting that controls some aspect of the power policy on the system, such as the display timeout, the idle-to-sleep timeout, or search indexing when idle. An instance of Win32_PowerSetting is created for each power setting defined on the system. This object represents a Windows power policy setting and describes the basic metadata for a single power setting.

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

Syntax

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

Members

The Win32_PowerSetting class has these types of members:

Properties

The Win32_PowerSetting class has these properties.

Description

Data type: string

Access type: Read-only

Specifies the description of the power setting.

ElementName

Data type: string

Access type: Read-only

Specifies the friendly name of the power setting.

InstanceID

Data type: string

Access type: Read-only

Specifies the unique identifier for the power setting instance.

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

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