Posted on 05-21-2023 11:12 AM
Hello All,
Am testing my installation of Jamf Connect. The scripts open an Applescript and the user select Accept to trigger the policy to install Jamf Connect. The log below appears randomly when testing. Could I be missing something in the script to avoid the error?
#!/bin/bash
## This will display a pop up window and freeze Finder. The user will have to click Accept to start the next line 'Start the policy'
button=$(/usr/bin/osascript << EOF
tell application "Finder"
activate
display dialog "Jamf Connect is here! Please save your work and click Accept." buttons {"Accept"} with icon POSIX file "/Library/Application Support/SunPower/brandingimage.icns" with title "Important!"
end tell
EOF)
sleep 5
# run policy with returned value
/usr/local/bin/jamf policy -event "$button"
Solved! Go to Solution.
05-21-2023 11:23 AM - edited 05-21-2023 11:40 AM
I’m not sure why you’re doing it this way. Just install Jamf Connect and then use Jamf Helper dialog to prompt the user to reboot if you want but there’s no need to prompt the user to accept this. Jamf connect can install without user prompt and will then take over at the next reboot for whatever your authentication method is you’ve configured.
if you do want to do it this way I’d still suggest using jamf helper and the jhc (available on GitHub) that will help you write the prompt you want in a nice a simple gui. Regardless the reason you’re getting this error is that jamf is running it periodic check in. If you want to run it like this you’ll have to kill the jamf process to make sure it’s not running when your script runs. You don’t have this issue with jamf helper.
05-21-2023 11:23 AM - edited 05-21-2023 11:40 AM
I’m not sure why you’re doing it this way. Just install Jamf Connect and then use Jamf Helper dialog to prompt the user to reboot if you want but there’s no need to prompt the user to accept this. Jamf connect can install without user prompt and will then take over at the next reboot for whatever your authentication method is you’ve configured.
if you do want to do it this way I’d still suggest using jamf helper and the jhc (available on GitHub) that will help you write the prompt you want in a nice a simple gui. Regardless the reason you’re getting this error is that jamf is running it periodic check in. If you want to run it like this you’ll have to kill the jamf process to make sure it’s not running when your script runs. You don’t have this issue with jamf helper.
Posted on 05-21-2023 05:36 PM
More to do with users not checking IT comms. Since Jamf Connect installs and pop-ups a window to sign in, I want to avoid confusion with the keychain error.
I will look into Jamf helper and jhc. Thanks for the explanation, that makes sense.
Posted on 05-21-2023 05:41 PM
form my experience with AppleScript there was some security settings to profile allow using pppc utility for it to work.
natively though I don't believe you will be able to code AppleScript directly within bash.
I only skimmed the article but this looks like it might help: https://scriptingosx.com/2020/09/avoiding-applescript-security-and-privacy-requests/
I've done something similar in the past to use apple script to prompt interactive messages.
Posted on 05-21-2023 05:45 PM
Perhaps you need a smart group to identify to only run the script, once the presence of the profile to allow AppleScript to be run.
Posted on 05-22-2023 02:40 AM
To resolve this issue and also to deploy Jamf connect correctly in mac use mentioned steps:-
It's always a good practice to refer to the official documentation and resources provided by Jamf for detailed guidance on deploying Jamf Connect in your specific setup.