CollapseAll image

Enumerate Battery

The following steps describe how to retrieve information about the batteries in the AMT device.

1.  Retrieve the list of CIM_Battery elements and examine the following properties:

a.   CIM_Battery.BatteryStatus to determine the current status of the battery (such as Low, Critical, or Fully Charged)

b.   CIM_Battery.Chemistry to determine the type of battery, such as Nickel Cadmium or Lithium-ion.

c.   CIM_Battery.EstimatedChargeRemaining to see an estimate of the percent of battery power remaining.

d.   CIM_Battery.FullChargeCapacity to see the battery’s mWh when fully charged.

e.   CIM_Battery.DesignVoltage to see the battery’s design voltage in millivolts.

2.  Create a reference to each instance of the battery so that the corresponding CIM_PhysicalPackage object can be identified.

3.  Use the list of CIM_PhysicalPackage objects to examine the following properties:

a.   CIM_PhysicalPackage.SerialNumber to see the battery’s identifying serial number.

b.   CIM_PhysicalPackage.Manufacturer to see the name of the organization responsible for producing the battery.

Click here for a snippet demonstrating this step

You can execute this snippet by inserting it into the execution template found here.

  

$batteryRef=$wsmanConnectionObject.NewReference("SELECT * FROM CIM_Battery")

foreach($batteryItemin$batteryRef.Enumerate("http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter",$null))

{

  $batteryInstance=$batteryItem.Object

  $batteryStatus=$batteryInstance.GetProperty("BatteryStatus")

  $chemistry=$batteryInstance.GetProperty("Chemistry")

  $estimatedChargeRemaining=$batteryInstance.GetProperty("EstimatedChargeRemaining")

  $fullChargeCapacity=$batteryInstance.GetProperty("FullChargeCapacity")

  $designVoltage=$batteryInstance.GetProperty("DesignVoltage")

 

  # Create reference to the CIM_Battery instance.

  $batteryInstanceRef=$batteryItem.Object.ToReference("DeviceID")

  $realizesRef=$wsmanConnectionObject.NewReference("CIM_Realizes")

  $realizesRef.AddSelector("Dependent",$batteryInstanceRef)

 

  # Traverse to the CIM_Realizes instances that are connected to the CIM_Battery instance.

  foreach($realizesItemin$realizesRef.Enumerate("http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter",$null))

  {

    # For each instance, check if it is associated to the CIM_PhysicalPackage instance.

    if($realizesItem.Object.GetProperty("Antecedent").IsA("CIM_PhysicalPackage"))

    {

          # Get the CIM_PhysicalPackage object using its EPR.

          $physicalPackageInstance=$realizesItem.Object.GetProperty("Antecedent").Ref.Get()

          $serialNumber=$physicalPackageInstance.GetProperty("SerialNumber")

          $manufacturer=$physicalPackageInstance.GetProperty("Manufacturer")

          break

    }

  }

}

 

 

Copyright © 2006-2022, Intel Corporation. All rights reserved.