osascript display dialog not appearing self service

pekoms
New Contributor

Hi all,

I've scoured the internet and have had just about zero luck with this. I'm trying to get my script to request user input and it works great. When I load it into jamf self service it runs and then finishes with no error but never prompts the user for anything. Can someone point me in the right direction?

I've tried getting the current user and running the command as them but no change.

3 REPLIES 3

pbenware1
Release Candidate Programs Tester

Can you post the script, or at least the part causing you problems?

We do something similar using Self Service and have no issues.

 

here is a snippet of our script:

hmsid=`osascript -e 'set T to text returned of (display dialog "Enter the HMS Account ID (formerly eCommons ID) of the person who has primary responsibility for this computer:" buttons {"Set User Name"} default button "Set User Name" default answer "")'`

echo_log "You entered the HMS ID $hmsid."

 

The response is then added as a flag to the recon step near the end of the script.

 

 

ubcoit
Contributor II

I have a couple scripts that run at login that are also available in Self Service that are currently working.  Copy/paste edit for your needs, hopefully it gets you going!

https://community.jamf.com/t5/jamf-pro/monterey-quot-jamf-wants-access-to-control-finder-quot/m-p/26...

PhillyPhoto
Valued Contributor

I'm actually having this exact issue. I did notice a few things:

  1. The policy kept spinning like it's running
  2. Sometimes when I stop the policy, the pop-up appears
  3. All subsequent attempts on the same device after stopping the policy the first time results in the pop-up working as expected and the script continues on it's merry way
  4. I never got any "Jamf wants access to...." dialogs at any point in any of these steps

This is turning in to an issue because I'm planning on using it to prompt users for their passwords if they're on M1 Macs to pass it to softwareupdate so it actually completes.

My code is really basic:

userpassword=$(osascript -e 'display dialog "Please enter your login password." default answer "" with icon stop buttons {"Cancel", "Continue"} default button "Continue" with hidden answer' | awk -F ':' '{print $3}')