PowerShell – get info on laptop battery

Another neat simple and useful PowerShell script to pull info on your laptop battery. I can quickly imagine that as the sysadmin you can easily add few more lines of code and run this on your network and scan all your laptops and get all the data about battery status on each laptop.

This PowerShell script just pulls the battery info from localhost :

$computer = "LocalHost"
$namespace = "rootCIMV2"
Get-WmiObject -class Win32_Battery -computername $computer -namespace $namespace

You will be able to get all this nice info:

***********************************

Availability
BatteryRechargeTime
BatteryStatus
Caption
Chemistry
ConfigManagerErrorCode
ConfigManagerUserConfig
CreationClassName
Description
DesignCapacity
DesignVoltage
DeviceID
ErrorCleared
ErrorDescription
EstimatedChargeRemaining
EstimatedRunTime
ExpectedBatteryLife
ExpectedLife
FullChargeCapacity
InstallDate
LastErrorCode
MaxRechargeTime
Name
PNPDeviceID
PowerManagementCapabilities
PowerManagementSupported
SmartBatteryVersion
Status
StatusInfo
SystemCreationClassName
SystemName
TimeOnBattery
TimeToFullCharge

********************************

Very nice 🙂