Battery Extension for the M1 MacBook Pro

dywane
New Contributor II

Hello All,

I recently added a M1 MacBook Pro to my JSS test environment. When I deploy the following battery cycle count extension to the M1 MBP, I get the following information back in the JSS.

!/bin/sh

echo "<result>$(ioreg -r -c "AppleSmartBattery" | grep -w "CycleCount" | awk '{print $3}' | sed s/"//g)</result>"

b95ee6bbd06c40f9abf05fb1dc2672f3

Is there another command I should be using specifically for the M1 MBP chip set? ¯_(ツ)_/¯

1 REPLY 1

unclekev
New Contributor II

Adjust the command to look like:

system_profiler SPPowerDataType | grep "Condition" | awk '{print $2}'

So your Extension Attribute script will look like:

#!/bin/sh
echo "<result>$(system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}')</result>"

ioreg command has been unreliable for a while now