Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WMI Battery Information

1,345 views
Skip to first unread message

Gert Pfeifer

unread,
Jul 7, 2004, 10:31:40 AM7/7/04
to
Hi everybody,

I am trying to find some information on the Battery of my Notebook. I found
only few values in Win32_Battery.
The IBM tool Akku-Maximizer is able to find information an current, voltage,
power (I think this value is calculated.)and also temperature. But in
Win32_Battery I only find some design values.

Where can I find more information on the battery?

Thanks!

Gert Pfeifer

Bobby Stark

unread,
Jul 7, 2004, 3:39:01 PM7/7/04
to
Here is what I found on the problem.

Win32_PortableBattery

The Win32_PortableBattery WMI class contains the properties related to a portable battery, such a notebook computer battery.

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


class Win32_PortableBattery : CIM_Battery
{
uint16 Availability;
uint32 BatteryRechargeTime;
uint16 BatteryStatus;
uint16 CapacityMultiplier;
string Caption;
uint16 Chemistry;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
string CreationClassName;
string Description;
uint32 DesignCapacity;
uint64 DesignVoltage;
string DeviceID;
boolean ErrorCleared;
string ErrorDescription;
uint16 EstimatedChargeRemaining;
uint32 EstimatedRunTime;
uint32 ExpectedBatteryLife;
uint32 ExpectedLife;
uint32 FullChargeCapacity;
datetime InstallDate;
uint32 LastErrorCode;
string Location;
string ManufactureDate;
string Manufacturer;
uint16 MaxBatteryError;
uint32 MaxRechargeTime;
string Name;
string PNPDeviceID;
uint16 PowerManagementCapabilities[];
boolean PowerManagementSupported;
string SmartBatteryVersion;
string Status;
uint16 StatusInfo;
string SystemCreationClassName;
string SystemName;
uint32 TimeOnBattery;
uint32 TimeToFullCharge;
};
Methods
The Win32_PortableBattery class defines the following methods.

Method Description
Reset Not implemented.
SetPowerState Not implemented.

Properties
The Win32_PortableBattery class has the following properties.

Availability
Data type: uint16
Access type: Read-only

Availability and status of the device. Power Save - Unknown indicates that the device is known to be in a power save mode, but its exact status is unknown; Power Save - Low Power Mode indicates that the device is in a power save state but still functioning, and may exhibit degraded performance; Power Save - Standby indicates that the device is not functioning but could be brought to full power quickly; and Power Save - Warning indicates that the device is in a warning state, though also in a power save mode. This property is inherited from CIM_LogicalDevice.

Value Meaning
1 Other
2 Unknown
3 Running/Full Power
4 Warning
5 In Test
6 Not Applicable
7 Power Off
8 Off Line
9 Off Duty
10 Degraded
11 Not Installed
12 Install Error
13 Power Save - Unknown
14 Power Save - Low Power Mode
15 Power Save - Standby
16 Power Cycle
17 Power Save - Warning
18 Paused
19 Not Ready
20 Not configured
21 Quiesced


BatteryRechargeTime
Data type: uint32
Access type: Read-only

Time required to fully charge the battery. This property is inherited from CIM_Battery.

Windows 2000: This property is not supported.
Windows XP and Windows Server 2003: This property is removed.


BatteryStatus
Data type: uint16
Access type: Read-only

Description of the battery's charge status. The value 10 (Undefined) is not valid in the Common Information Model (CIM) schema because in Desktop Management Interface (DMI) it represents that no battery is installed. In this case, this object should not be instantiated. This property is inherited from CIM_Battery.

Value Meaning
1 Other
2 Unknown
3 Fully Charged
4 Low
5 Critical
6 Charging
7 Charging and High
8 Charging and Low
9 Charging and Critical
10 Undefined
11 Partially Charged


CapacityMultiplier
Data type: uint16
Access type: Read-only

Multiplication factor of the DesignCapacity value to ensure that the milliwatt hour value does not overflow for Smart Battery Data Specification (SBDS) implementations.


Caption
Data type: string
Access type: Read-only

Short description of the object—a one-line string. This property is inherited from CIM_ManagedSystemElement.


Chemistry
Data type: uint16
Access type: Read-only

Chemistry of the battery. This property is inherited from CIM_Battery.

Value Meaning
1 Other
2 Unknown
3 Lead Acid
4 Nickel Cadmium
5 Nickel Metal Hydride
6 Lithium-ion
7 Zinc air
8 Lithium Polymer


ConfigManagerErrorCode
Data type: uint32
Access type: Read-only

Windows Configuration Manager error code. This property is inherited from CIM_LogicalDevice.

Error Meaning
0 This device is working properly.
1 This device is not configured correctly.
2 Windows cannot load the driver for this device.
3 The driver for this device might be corrupted, or your system may be running low on memory or other resources.
4 This device is not working properly. One of its drivers or your registry might be corrupted.
5 The driver for this device needs a resource that Windows cannot manage.
6 The boot configuration for this device conflicts with other devices.
7 Cannot filter.
8 The driver loader for the device is missing.
9 This device is not working properly because the controlling firmware is reporting the resources for the device incorrectly.
10 This device cannot start.
11 This device failed.
12 This device cannot find enough free resources that it can use.
13 Windows cannot verify this device's resources.
14 This device cannot work properly until you restart your computer.
15 This device is not working properly because there is probably a re-enumeration problem.
16 Windows cannot identify all the resources this device uses.
17 This device is asking for an unknown resource type.
18 Reinstall the drivers for this device.
19 Failure using the VXD loader.
20 Your registry might be corrupted.
21 System failure. Try changing the driver for this device. If that does not work, see your hardware documentation. Windows is removing this device.
22 This device is disabled.
23 System failure. Try changing the driver for this device. If that doesn't work, see your hardware documentation.
24 This device is not present, is not working properly, or does not have all its drivers installed.
25 Windows is still setting up this device.
26 Windows is still setting up this device.
27 This device does not have valid log configuration.
28 The drivers for this device are not installed.
29 This device is disabled because the firmware of the device did not give it the required resources.
30 This device is using an Interrupt Request (IRQ) resource that another device is using.
31 This device is not working properly because Windows cannot load the drivers required for this device.


ConfigManagerUserConfig
Data type: boolean
Access type: Read-only

If TRUE, the device is using a user-defined configuration. This property is inherited from CIM_LogicalDevice.


CreationClassName
Data type: string
Access type: Read-only
Qualifiers: Key, MaxLen(256)

Name of the first concrete class that appears in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be uniquely identified. This property is inherited from CIM_LogicalDevice.


Description
Data type: string
Access type: Read-only

Description of the object. This property is inherited from CIM_ManagedSystemElement.


DesignCapacity
Data type: uint32
Access type: Read-only

Design capacity of the battery in milliwatt-hours. If this property is not supported, enter 0 (zero). This property is inherited from CIM_Battery.


DesignVoltage
Data type: uint64
Access type: Read-only

Design voltage of the battery in Millivolts. If this attribute is not supported, enter 0 (zero). This property is inherited from CIM_Battery.


DeviceID
Data type: string
Access type: Read-only

Battery identifier. This property is inherited from CIM_LogicalDevice.

Example: "Internal Battery"


ErrorCleared
Data type: boolean
Access type: Read-only

If TRUE, the error reported in LastErrorCode is now cleared. This property is inherited from CIM_LogicalDevice.


ErrorDescription
Data type: string
Access type: Read-only

More information about the error recorded in LastErrorCode, and any corrective actions that may be taken. This property is inherited from CIM_LogicalDevice.


EstimatedChargeRemaining
Data type: uint16
Access type: Read-only

Estimate of the percentage of full charge remaining. This property is inherited from CIM_Battery.


EstimatedRunTime
Data type: uint32
Access type: Read-only

Estimate in minutes of the time to battery charge depletion under the present load conditions if the utility power is off, or lost and remains off, or a laptop is disconnected from a power source. This property is inherited from CIM_Battery.


ExpectedBatteryLife
Data type: uint32
Access type: Read-only

Amount of time it takes to completely drain the battery after it has been fully charged. This property is inherited from CIM_Battery.

Windows 2000: This property is not supported.
Windows XP and Windows Server 2003: This property has been removed.

ExpectedLife
Data type: uint32
Access type: Read-only

Battery's expected lifetime in minutes, assuming that the battery is fully charged. This property represents the total expected life of the battery, not its current remaining life, which is indicated by the EstimatedRunTime property. This property is inherited from CIM_Battery.


FullChargeCapacity
Data type: uint32
Access type: Read-only

Full charge capacity of the battery in milliwatt-hours. Comparison of this value to the DesignCapacity property determines when the battery requires replacement. A battery's end of life is typically when the FullChargeCapacity property falls below 80% of the DesignCapacity property. If this property is not supported, enter 0 (zero). This property is inherited from CIM_Battery.


InstallDate
Data type: datetime
Access type: Read-only

Date and time the object was installed. This property does not need a value to indicate that the object is installed. This property is inherited from CIM_ManagedSystemElement.


LastErrorCode
Data type: uint32
Access type: Read-only

Last error code reported by the logical device. This property is inherited from CIM_LogicalDevice.


Location
Data type: string
Access type: Read-only

Physical location of the battery. This property is filled by the computer manufacturer.

Example: "In the back, on the left-hand side"


ManufactureDate
Data type: string
Access type: Read-only

Date when the battery was manufactured.


Manufacturer
Data type: string
Access type: Read-only

Manufacturer of the battery.


MaxBatteryError
Data type: uint16
Access type: Read-only
Qualifiers: Units(Percent)

Difference between the highest estimated amount of energy left in the battery and the current amount reported by the battery.


MaxRechargeTime
Data type: uint32
Access type: Read-only

Maximum time, in minutes, to fully charge the battery. This property represents the time to recharge a fully depleted battery, not the current remaining charge time, which is indicated in the TimeToFullCharge property. This property is inherited from CIM_Battery.


Name
Data type: string
Access type: Read-only

Label by which the object is known. When subclassed, the property can be overridden to be a key property. This property is inherited from CIM_ManagedSystemElement.


PNPDeviceID
Data type: string
Access type: Read-only

Windows Plug and Play device identifier of the logical device. This property is inherited from CIM_LogicalDevice.

Example: "*PNP030b"


PowerManagementCapabilities
Data type: uint16 array
Access type: Read-only

Array of the specific power-related capabilities of a logical device. The Enabled value indicates that the power management features are currently enabled but the exact feature set is unknown or the information is unavailable. Power Saving Modes Entered Automatically indicates that a device can change its power state based on usage or other criteria. Power State Settable indicates that the SetPowerState method is supported. Power Cycling Supported indicates that the SetPowerState method can be invoked with the PowerState parameter set to 5 (Power Cycle). Timed Power On Supported indicates that the SetPowerState method can be invoked with the PowerState parameter set to 5 (Power Cycle) and Timeset to a specific date and time, or interval, for power-on. This property is inherited from CIM_LogicalDevice.

Value Meaning
0 Unknown
1 Not Supported
2 Disabled
3 Enabled
4 Power Saving Modes Entered Automatically
5 Power State Settable
6 Power Cycling Supported
7 Timed Power On Supported


PowerManagementSupported
Data type: boolean
Access type: Read-only

If TRUE, the device can be power-managed (can be put into suspend mode, and so on). The property does not indicate that power management features are currently enabled, only that the logical device is capable of power management. This property is inherited from CIM_LogicalDevice.


SmartBatteryVersion
Data type: string
Access type: Read-only

Smart Battery Data Specification version number supported by this battery. If the battery does not support this function, the value should be left blank. This property is inherited from CIM_Battery.


Status
Data type: string
Access type: Read-only

Current status of the object. Various operational and non-operational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard drive, may be functioning properly but predicting a failure in the near future). Non-operational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states. This property is inherited from CIM_ManagedSystemElement.

Values are the following:

"OK"
"Error"
"Degraded"
"Unknown"
"Pred Fail"
"Starting"
"Stopping"
"Service"
"Stressed"
"NonRecover"
"No Contact"
"Lost Comm"

StatusInfo
Data type: uint16
Access type: Read-only

State of the logical device. If this property does not apply to the logical device, the value 5 (Not Applicable) should be used. This property is inherited from CIM_LogicalDevice.

Value Meaning
1 Other
2 Unknown
3 Enabled
4 Disabled
5 Not Applicable


SystemCreationClassName
Data type: string
Access type: Read-only

Value of the scoping computer's CreationClassName property. This property is inherited from CIM_LogicalDevice.


SystemName
Data type: string
Access type: Read-only

Name of the scoping system. This property is inherited from CIM_LogicalDevice.


TimeOnBattery
Data type: uint32
Access type: Read-only

Elapsed time in seconds since the computer system's UPS last switched to battery power, or the time since the system or UPS was last restarted, whichever is less. If the battery is online, 0 (zero) is returned. This property is inherited from CIM_Battery.


TimeToFullCharge
Data type: uint32
Access type: Read-only

Remaining time in minutes to charge the battery fully at the current charge rate and usage. This property is inherited from CIM_Battery.


Remarks
The Win32_PortableBattery class is derived from CIM_Battery.

Requirements
Client: Requires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0 SP4 and later.
Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0 SP4 and later.
Header: Declared in Cimwin32.mof.
Namespace: Included in \root\cimv2.


See Also
Computer System Hardware Classes

Gert Pfeifer

unread,
Jul 9, 2004, 4:37:48 AM7/9/04
to
I'm already aware of this class, but where can I get further information. In
Win32_battery is nothing about current and temperature. I would like to
calculate the power in a particular instant of time by using the measured
currend and voltage. There are some promising classes like
Win32_CurrentProbe, but these are not instanciated on my system.


"Bobby Stark" <Bobby...@discussions.microsoft.com> schrieb im Newsbeitrag
news:43235268-A607-42A7...@microsoft.com...

> Short description of the object-a one-line string. This property is

Bobby Stark

unread,
Jul 9, 2004, 10:55:01 AM7/9/04
to
Your IBM ThinkPad / Notebook Akku-Maximizer is a driver that talks to the Kernel. You would have to write a driver that would get the info from the config space of the battery device. I was going to write a PCI bus scaning tool and I was going have to do the samething.

IBM Software Engineer
Bobby Stark

M.@discussions.microsoft.com Michael M.

unread,
Jul 15, 2004, 1:16:01 PM7/15/04
to
Hello Gert,
If you are using the WMI CIM Studio browser free tools, you can connect to WMI namespace (not the CIMV2 namespace) and search for "battery" you will see more Battery classes, under MSBatteryClass. If you select a clas and then push the "Instances" button on the top right side of the page it will show you if your system has active instances of these classes. You may find some of what you are looking for there. Also I believe that your system would need a current probe device installed for there to be an instance of the Win32_CurrentProbe class. Hope this helps.
Michael
Software Engineer
0 new messages