Last Modified Date6/22/2021 2:16 PM
This script was taken from a Reddit Post and modified to work within N-Central 2021.1+
The script gets battery information for all batteries (usually for most laptops there should be only one), and will compare the reported full charged capacity (in milli-watt-hours) and will compare it to the designed capacity. it will generate a percentage from it and will report on the ''health'' of the battery based on that.
If multiple batteries are found, it will show details for all of them but will only threshold on the worse one.
Custom Service / Script Check
Windows 8/8.1;Windows 10;Windows Server 2012 / 2012R2;Windows Server 2016;Windows Server 2019
Compatible with N-Central
N-Central minimum version
Compatible with RMM
To use this, simply upload the policy to your N-central server.
Once uploaded, create a custom service and pick this automation policy.
In the thresholds, we recommend putting 0-60 as failed, 60-70 as warning, and 70-100 as normal.
the other items should not have thresholds.
The Policy will output the following data points :
Policy Output Parameters:
Battery Serial Number: bq20z45109PJ35CAV847DZACACDANA
Calculated Battery Capacity Left %: 82
Designed Capacity (milliwatt-hours): 73360
Full Capacity (milliwatt-hours): 60440
Number of Batteries Found on This System: 1
Details About All Batteries Found: bq20z45109PJ35CAV847DZACACDANA , Capacity%: 82 , DesignedCapacity: 73360 , FullCharge: 60440
if multiple batteries are found, the last output ("details") will output the info for all batteries, however the worse one will be shown above so it can be thresholded against