Created
March 8, 2017 05:06
-
-
Save vmwarecode/f0ccefd78927762eab3a92f21c583772 to your computer and use it in GitHub Desktop.
macOS - Common System Information Custom Attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## SIP-STATUS ## | |
csrutil status | awk '{print toupper($5)}' | sed 's/\.//g' | |
## OS-MINORBUILDVERSION ## | |
/usr/bin/sw_vers -buildVersion | |
## BATTERY-CYCLECOUNT ## | |
ioreg -r -c "AppleSmartBattery" | grep -w "CycleCount" | awk '{print $3}' | sed s/\"//g | |
## BATTERY-HEALTHSTATUS ## | |
result=`ioreg -r -c "AppleSmartBattery" | grep "PermanentFailureStatus" | awk '{print $3}' | sed s/\"//g` | |
if [ "$result" == "1" ]; then | |
result="FAIL" | |
elif [ "$result" == "0" ]; then | |
result="OK" | |
fi | |
echo $result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment