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
[UUID("{86460B6B-E709-11d2-B139-00105A1F77A1}"), AMENDMENT]
class Win32_PowerManagementEvent : __ExtrinsicEvent
{
uint8 SECURITY_DESCRIPTOR[];
uint64 TIME_CREATED;
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
-
Qualifiers: MappingStrings ("Win32API|Power Management Events")
Type of change in the system power state.
-
-
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 Resume from Suspend message has been sent, enabling the computer to return to its regular power state.
-
Power Status Change (10)
-
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
-
Qualifiers: MappingStrings ("Win32API|Power Management Events")
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.
SECURITY_DESCRIPTOR
-
Data type: uint8 array
-
Access type: Read-only
Descriptor used by the event provider to determine which users can receive the event. This property is inherited from __Event. For more information about constants used to set this security descriptor, see WMI Security Constants.
TIME_CREATED
-
Data type: uint64
-
Access type: Read-only
Unique value that indicates the time at which the event was generated. This is a 64-bit value that represents the number of 100-nanosecond intervals after January 1, 1601. The information is in the Coordinated Universal Times (UTC) format.
This property is inherited from __Event.
For more information about using uint64 values in scripts, see Scripting in WMI.
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.
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
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Namespace |
Root\CIMV2 |
MOF |
|
DLL |
|
See also