displayMessage.sh fails with error of type -10810

k3vmo
Contributor II

Attempted the displayMessage.sh provided by Jamf.

Very inconsistent between OS versions but the policy comes back with:

Script result: Displaying message to user...
36:341: execution error: An error of type -10810 has occurred. (-10810)

It exits successfully on some systems - they don't see the message
The rest fail with that error ..

I can't determine why ... any input appreciated

4 REPLIES 4

k3vmo
Contributor II

Does the 36:341 indicate that's a location within the script?

mksf2019
New Contributor

We're having this same issue with the same script - any help would be appreciated! Seems to work some of the time for some machines and fail for others.

1 test machine failed at first, we flushed the policy, and then it completed the second time. Could not determine the circumstances that made a difference in completion.

sgoetz
Contributor

That error looks to be an error with Apple Script. After looking at the script its probably to do with this line:

osascript -e 'tell application "System Events" to display dialog "'"$message" -e '"buttons {"OK"} default button 1';;

if thats the case I believe 1) Jamf or this script has to be approved to run osascripts, and 2) the osascript part needs to be run as the user. try sudo -u <username> osascript -e .......

Thats my 2 cents ;P

Shawn

arminBriegel
New Contributor III
New Contributor III

There are two thing might be the issue here. The first is that you may be running into privacy (PPPC) blocking your script from sending an event to "System Events." The good news here is that you don't need the tell app "System Events" in this case:

osascript -e 'display dialog "'"$message" -e '"buttons {"OK"} default button 1'

Will work just fine, without triggering PPPC dialogs.

The second is that osascript command should run as the current user. Anything that interacts with user interface or user processes should run as the current user and not as root. However, scripts run from Jamf Policies will run as root. I describe a solution for this here: Running a Command as another User – Scripting OS X