workflow / jamf helper question

LaMantia
New Contributor III

Thank you in advance for any assistance.

need: I need to make a simple UI with input and response ability so employees are not required to open terminal. Users currently need to enter a challenge token using the CLI in terminal. Am I on the right path? Is this the cleanest way to do this?

sudo is not a requirement for the command to run

  1. code given to user
  2. user goes to self service to select policy and run a script
  3. user is prompted for token using jamf helper
  4. token passed as a variable to cli command
  5. cli command response echoed back to user
  6. click to dismiss
2 REPLIES 2

ShaunRMiller83
Contributor III

Smarter people than me may have different insight on this.

I would say you are on the right track one call out thought is that I don't believe the JAMF Helper can ask for user input.

The way you might want to approach it to get around that challenge would be to called up AppleScript in a shell script.

a quick example of this would be:

#!/bin/sh

##Get Current User
currentUser=$( /usr/bin/stat -f %Su /dev/console )
echo "Current user is $currentUser"

/usr/bin/osascript <<EOT

  set theResponse to display dialog "What's your code?" default answer "" with icon stop buttons {"Cancel", "Continue"} default button "Continue" with hidden answer

display dialog "My Secret Code is " & (text returned of theResponse) & "."

EOT

LaMantia
New Contributor III

Thank you Shawn. Much appreciated. I can work from this. I'm a newb at osascript but it is a good change to learn some new tricks. :)