Posted on 03-20-2014 02:13 PM
I have come across several MBPs in our environment where the battery was "failing" although they don't say that anymore. Some time ago Apple changed the battery condition status to things like:
- Replace Soon
- Replace Now
- Service Battery
The question is, how can I try to collect this information in the JSS? The Battery Health Status extension attribute doesn't look nor collect this type of information so it doesn't report correctly.
Is there a new extension attribute that will collect this information from our machines? Can we do this with a script?
In other words, is there a way to collect and report on these new statuses?
http://support.apple.com/kb/ht3782
Posted on 03-21-2014 01:52 AM
I don't have any duff batteries around me, but what happens when you type the following on one that does.
printf "get State:/IOKit/PowerSources/InternalBattery-0
d.show" | scutil
or
pmset -g batt
Posted on 03-21-2014 05:31 AM
sean's method was something I have never seen before. But it seems it would work to make an Extension Attribute that reports the battery health.
#!/bin/bash
batteryHealth=$(printf "get State:/IOKit/PowerSources/InternalBattery-0
d.show" | scutil | awk '/BatteryHealth/ {print $3}')
echo "<result>$batteryHealth</result>"
Posted on 04-02-2015 12:53 AM
Not sure if its ok to bump an old thread but the above Extension Attribute did not seem to work for me on 10.10 so I tinkered together this.
#!/bin/sh
batteryHealth=$(/usr/sbin/system_profiler -xml SPPowerDataType -detailLevel mini | grep -A 1 <key>sppower_battery_health</key> | awk '/string/' | sed 's/.*<string>(.*)</string>.*/1/')
if [ "$batteryHealth" == "" ]; then
echo "<result>Not present</result>"
else
echo "<result>$batteryHealth</result>"
fi
Posted on 02-05-2016 10:51 AM
@daviddejong - Your script works great. Do you happen to know all the results possible? (or a way I can find that out) I didn't come up with anything out on the inter webs. As far as I know these are the results:
"Not Present", "Good", "Check Battery"
Is "Poor Permanent" one as well or was that replaced by other verbiage? Another other result possibilities?
Posted on 02-10-2016 05:57 PM
@benducklow I'm looking into this now too. I have found "Fair" can be added to the list.
Posted on 02-11-2016 05:29 AM
Cool. Thanks @gskibum. I haven't come across that one as a result (yet).
Posted on 03-15-2016 03:21 PM
I'm guessing it's the same as Yosemite.
OS X Yosemite: Battery conditions
OS X Yosemite: If your battery’s status is “Not Charging”
Normal
Replace Soon
Replace Now
Service Battery
Not Charging
Posted on 08-24-2017 05:58 AM
This is the attribute that works nicely for us:
#!/bin/sh
#Determine model
model=`system_profiler SPHardwareDataType | grep "Model Name:" | cut -d ' ' -f 9`
if [[ "$model" =~ "Book" ]]; then
#Determine battery condition
result=`system_profiler SPPowerDataType | grep "Condition" | cut -d ':' -f 2 | sed -e 's/^[[:space:]]*//'`
echo "<result>$result</result>"
else
echo "<result>Not A MacBook</result>"
fi
Possible Values for Sierra:
Sierra Battery Status