Skip to main content
Question

Battery Extension for the M1 MacBook Pro

  • April 15, 2021
  • 1 reply
  • 70 views

Forum|alt.badge.img+3

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>"

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

1 reply

Forum|alt.badge.img+5
  • New Contributor
  • April 16, 2021

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