Skip to main content
Solved

Script Error


Forum|alt.badge.img+2

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:

!/bin/bash

this script will check the status of Find My Mac. If it isn't running, it will end, otherwise it will execute the AppleScript below that

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.

Best answer by skeenan07

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

View original
Did this topic help you find an answer to your question?

2 replies

skeenan07
Forum|alt.badge.img+10
  • Contributor
  • 34 replies
  • Answer
  • June 23, 2021

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


Forum|alt.badge.img+2

Hi Skeenan07,

 

Apologies on the late response.  Thank you very much for the help.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings