Script issue -

LuisSP
New Contributor

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?

 

Screenshot 2023-05-21 at 1.01.12 PM.png

 

#!/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"

1 ACCEPTED SOLUTION

MatthewGC
New Contributor III

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. 

View solution in original post

5 REPLIES 5

MatthewGC
New Contributor III

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. 

LuisSP
New Contributor

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. 

Malcolm
Contributor II

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.

 

Malcolm
Contributor II

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.

Jaykrishna1
Contributor II

To resolve this issue and also to deploy Jamf connect correctly in mac use mentioned steps:-

  1. Install the Jamf Connect application on your macOS devices:
    • Use your preferred method to deploy the Jamf Connect installer package to your macOS devices. This could be through Jamf Pro, a package deployment tool, or any other method you typically use for software deployment.

 

  1. Configure Jamf Connect settings:
    • Launch Jamf Connect on a test device.
    • Enter the necessary configuration details, such as your Jamf Pro server URL, Jamf Pro user credentials, and any other required information.
    • Test the configuration to ensure the connection with your Jamf Pro server is successful.
    • Customize any additional settings or authentication methods as per your requirements.

 

  1. Create policies in Jamf Pro:
    • Log in to your Jamf Pro server.
    • Create policies to configure and deploy settings for Jamf Connect.
    • Define the desired behavior, such as enabling single sign-on (SSO), configuring authentication methods, specifying branding or appearance options, etc.
    • Assign the policies to the appropriate macOS devices or user groups.

 

  1. Test the deployment:
    • Deploy the Jamf Connect policies to a test group of devices or users.
    • Verify that the settings and authentication methods are applied correctly.
    • Test the user experience and ensure that users can successfully authenticate and access resources.
  2. Roll out to production:
    • Once you've successfully tested the deployment and ensured it meets your requirements, you can proceed with deploying Jamf Connect to your production devices or users.
    • Monitor the deployment to ensure it progresses smoothly and address any issues that may arise.

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.