root\wmi–MSBatteryClass
Posted by: Richard Siddaway
A number of the classes in root\wmi return results from more than one class. That sounds odd but it can be explained by an example.
The namespace contains a number of classes related to the battery in laptops
gwmi -Namespace root\wmi -List *battery*
MSBatteryClassEvent
BatteryStatusChange
BatteryTagChange
MSBatteryClass
BatteryStaticData
BatteryRuntime
BatteryCycleCount
BatteryTemperature
BatteryStatus
BatteryFullChargedCapacity
We’ll ignore the event and change classes for now. If we pick out the MSBattery class we get information from a number of other classes returned – MSBattery is a super class.
PS> gwmi -Namespace root\wmi -Class MSBatteryClass | select __class
__CLASS
——-
BatteryCycleCount
BatteryFullChargedCapacity
BatteryStaticData
BatteryRuntime
BatteryStatus
Be aware that the runtime property returned by BatteryRuntime doesn’t respond to calculations you may find on the Internet when your OS is Windows 7
Battery status is a useful class to determine if you are on battery or external power & if the battery is charging




