Posted on 06-22-2021 11:25 AM
Good day everyone,
I'm hoping that I can get a second set of eyes on this script. It is designed to check the status of Find My Mac, and works find locally, but it is erroring out when I run it through a Jamf Policy.
Here is the script:
fmmStatus=$()
if [[ "$fmmStatus" = 0 ]]; then
echo "Find My Mac Not Running"
exit 1
else
osascript -e "tell application "System Events" to display dialog "Hey there!
IT requests you please stop using "Find My Mac" on this MacBook Pro as it has been found to interfere with our Mobile Device Management security settings.
Please go to System Preferences > Apple ID > Find My Mac and disable the checkbox for this feature.
If you have any questions please reach out to IT and we can help you out. Thanks!"
fi
exit 0
I receive the error message of -> Script result: 110:115: syntax error: A identifier can’t go after this “"”. (-2740)
Any help would be appreciated it.
Thank you.
Solved! Go to Solution.
06-23-2021 10:48 AM - edited 09-28-2021 06:34 AM
You need to escape the quotation marks around Find My Mac. See the following:
osascript -e 'set message to "Hey there! IT requests you please stop using \"Find My Mac\" on this MacBook Pro as it has been found to interfere with our Mobile Device Management security settings. Please go to System Preferences > Apple ID > Find My Mac and disable the checkbox for this feature. If you have any questions please reach out to IT and we can help you out. Thanks!" tell application "System Events" to display dialog message'
Also, when you add a script to your post, it is easier to read when you wrap it in ```
06-23-2021 10:48 AM - edited 09-28-2021 06:34 AM
You need to escape the quotation marks around Find My Mac. See the following:
osascript -e 'set message to "Hey there! IT requests you please stop using \"Find My Mac\" on this MacBook Pro as it has been found to interfere with our Mobile Device Management security settings. Please go to System Preferences > Apple ID > Find My Mac and disable the checkbox for this feature. If you have any questions please reach out to IT and we can help you out. Thanks!" tell application "System Events" to display dialog message'
Also, when you add a script to your post, it is easier to read when you wrap it in ```
Posted on 08-25-2021 08:57 PM
Hi Skeenan07,
Apologies on the late response. Thank you very much for the help.