Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Win32_PowerManagementEvent class

The Win32_PowerManagementEvent WMI class represents power management events resulting from power state changes. These state changes are associated with either the Advanced Power Management (APM) or the Advanced Configuration and Power Interface (ACPI) system management protocols.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties are listed in alphabetic order, not MOF order.

Syntax

class Win32_PowerManagementEvent : __ExtrinsicEvent
{
  uint16 EventType;
  uint16 OEMEventCode;
};

Members

The Win32_PowerManagementEvent class has these types of members:

Properties

The Win32_PowerManagementEvent class has these properties.

EventType
Data type: uint16
Access type: Read-only

Type of change in the system power state.

ValueMeaning
Entering Suspend
4

While suspended, the computer appears to be off; however, it can be "awakened" in response to various events, including user input (such as moving the mouse or pressing a key on the keyboard). While the computer is suspended, power consumption is reduced to one of several levels depending on how the system is to be used. The lower the level of power consumption, the more time it takes the system to return to the working state. When the computer enters the suspend state, the desktop is locked, and you must press CTRL+ALT+DELETE and provide a valid user name and password to resume operations

Resume From Suspend
7

Indicates that a ResumeSuspend message has been sent, enabling the computer to return to its regular power state.

10

Power Status Change

Indicates a change in the power status of the computer, such as a switch from battery power to AC, or from AC to an uninterruptible power supply. The system also broadcasts this event when remaining battery power slips below the threshold specified by the user or if the battery power changes by a specified percentage.

OEM Event
11

Indicates that an Advanced Power Management (APM) BIOS has sent an OEM event. The value of the event will be captured in the OEMEventCode property. Because some APM BIOS implementations do not provide OEM event notifications, this event might never be broadcast on some computers. APM is a legacy power management scheme. Although still supported, APM has been largely superseded by ACPI (Advanced Configuration and Power Interface).

Resume Automatic
18

Indicates that the computer has awakened in response to an event. If the system detects user activity (such as a mouse click), the ResumeSuspend message will be broadcast, letting applications know that they can resume full interactivity with the user.

 

OEMEventCode
Data type: uint16
Access type: Read-only

System power state defined by the original equipment manufacturer (OEM) when the EventType property of this class is set to 11 (OEM Event); otherwise, this property is set to NULL. OEM events are generated when an APM BIOS signals an APM OEM event. OEM event codes are in the range 0x0200h - 0x02FFh.

Remarks

The Win32_PowerManagementEvent class is derived from __ExtrinsicEvent.

Changes in power status often indicate that a problem has occurred with a computer or with another managed device. If a server suddenly switches from AC power to an uninterruptible power supply, this change can indicate that an electrical problem of some kind has occurred, either with the computer itself or with the electrical system in the room in which the computer is kept.

Administrators need to monitor these changes in power status and be notified of such changes immediately. This enables them to take action before the device loses power entirely. (Uninterruptible power supply systems, for example, might run for only 15 minutes or so before shutting down.)

The Win32_PowerManagementEvent class can be used to monitor changes in power status on a computer. These changes can include a switch from one power source to another as well as a change in computer power state (for example, entering or exiting Suspend mode).

The Win32_PowerManagementEvent class has only two properties: EventType, used to indicate the type of power change event that occurred, and OEMEventType, which is used by some original equipment manufacturers to define additional power change events.

For more information on responding to Windows power events, see the Monitor and Respond to Windows Power Events with PowerShell article on the Hey! Scripting Guy! blog.

For more information on charging laptops, see Hey, Scripting Guy! How Can I Retrieve Information About Laptops Changing from Full Power to Minimal Power Usage?

Examples

The following VBScript monitors changes in power status on a computer.


Set colMonitoredEvents = GetObject("winmgmts:")._
 ExecNotificationQuery("SELECT * FROM Win32_PowerManagementEvent")
Do
 Set strLatestEvent = colMonitoredEvents.NextEvent
 Wscript.Echo strLatestEvent.EventType
Loop

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Namespace

\root\CIMV2

MOF

CIMWin32.mof

DLL

CIMWin32.dll

See also

Computer System Hardware Classes
Monitoring Changes in Computer Power Status

 

 

Show:
© 2014 Microsoft