A good extension attribute is worth it’s weight a thousand times over it if can save you time.

I’ve included here a collection of the extension attributes that I’ve collected/written for the Casper Suite that have saved me countless hours. Some of them are quite specific but hopefully they can be of use to you. If you have any questions or would like some help with writing a custom extension tweet me @jacobcurulli

Battery Health Status


result=`ioreg -r -c "AppleSmartBattery" | grep "PermanentFailureStatus" | awk '{print $3}' | sed s/\"//g`

if [ "$result" == "1" ]; then
elif [ "$result" == "0" ]; then

echo "<result>$result</result>"


Java Version Installed

#Check if java_home is defined
javaHome=`/usr/libexec/java_home 2> /dev/null`;

if [ ! -z $javaHome ]
vers=`java -version 2>&1 | grep "java version" | awk '{print substr($3,2,length($3)-2);}'`
echo "<result>$vers</result>"
echo "<result>Not Installed</result>"


Flash Version Installed


result=`/usr/bin/defaults read /Library/Internet\ Plug-Ins/Flash\ Player.plugin/Contents/version CFBundleShortVersionString`

echo "<result>$result</result>"


Battery Serial Number

battery='ioreg -r -c "AppleSmartBattery" | grep "BatterySerialNumber" | awk '{print $3}' | sed s/\"//g'

echo "<result>$battery</result>"


Firewall Status (on or off)

result=`/usr/bin/defaults read /Library/Preferences/com.apple.alf globalstate`
if [ "$result" == "0" ]; then
  echo "<result>Off</result>"
  echo "<result>On</result>"


List all users on the local machine

# Get a list of users, filter out service accounts
users=`dscl /Local/Default -list /Users uid | awk '$2 >= 100 && $0 !~ /^_/ { print $1 }'`

# Output for extension attribute
echo '<result>'$users'</result>' 


List all admin users on the local machine

admin=`dscl . -read /Groups/admin GroupMembership`

#Output for extension attribute
echo '<result>'$admin'</result>'