Find My Mac Extension Attribute for Sonoma

Spitzer
New Contributor II

We have been using an EA to find Macs that have Find My enabled. It worked in Monterey and Ventura, but now in Sonoma it is coming up with blank results. 
Anyone have ideas how to correct it?

#!/bin/bash
# iCloud_FindMyMac.sh
# Purpose: to see if machine is enrolled in Find My Mac

plistBud="/usr/libexec/PlistBuddy"

loggedInUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )

if [[ -e "/Users/$loggedInUser/Library/Preferences/MobileMeAccounts.plist" ]]; then
    #FindMyMac=`$plistBud -c "print :Accounts:0:Services:11:Enabled" /Users/$loggedInUser/Library/Preferences/MobileMeAccounts.plist`
    FindMyMac=`$plistBud -c "print :Accounts:0:Services:" /Users/$loggedInUser/Library/Preferences/MobileMeAccounts.plist | grep FIND_MY_MAC -C1 | grep Enabled | awk '{print $3}'`
else
    FindMyMac="Not Enabled"
fi

echo "<result>$FindMyMac</result>"
2 REPLIES 2

wildfrog
Contributor II

This is what we're using - 

#!/bin/bash

fmmToken=$(/usr/sbin/nvram -x -p | /usr/bin/grep fmm-mobileme-token-FMM)

if [ -z "$fmmToken" ]; then
    
    echo "<result>Disabled</result>"
    
else
    
    echo "<result>Enabled</result>"
    
fi

Utilizator
Contributor

We use this, working for us in Sonoma:

 

#!/bin/sh

# Determine whether Find My Mac has been set on Mac.
# Values are stored in NRAM and will be: "Enabled" or "Disabled".

fmmToken=$(/usr/sbin/nvram -x -p | /usr/bin/grep "fmm-mobileme-token-FMM")

if [ -z "$fmmToken" ]; then
echo "<result>Disabled</result>"
else
echo "<result>Enabled</result>"

fi
exit 0