Skip to main content

Grr, there's a post on here I can't find about using jamfHelper utility window to read a button click from a user as to whether or not they want to run updates.



Does anyone know where I can find the code for this, or at least point me in the right direction?

If its the one I'm thinking about, its not in the Discussions, its under the Feature Request section. See if this was it:



https://jamfnation.jamfsoftware.com/featureRequest.html?id=751


Use the Terminal to run:



/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -help


Buttons can return all sorts of nifty things.


This one? https://jamfnation.jamfsoftware.com/featureRequest.html?id=751


Thanks everyone!


Really clunking heads on the way to that answer, weren't we?


lol, yeah, I think that was record. 3 posts to the answer within a 1 minute window.


Hi Everyone,



I wrote this as proof of concept for a few people in the past of a way of end user interaction. It is bash script that calls Applescript to display a yes or no GUI box and then does something based on what the user clicks on. Obviously, everything here is a place holder. You could change it up to run custom trigger policies, or call the JAMF binary to display messages. Tons of different application here.



code example:



#!/bin/bash

# proof of concept AppleScript interaction to end user in bash

theAnswer=$(/usr/bin/osascript <<AppleScript
tell application "Finder"
activate
display dialog "Do you want to know the meaning of the universe?" buttons {"No","Yes"} default button 2
if the button returned of the result is "No" then
set theAnswer to No
end if
end tell
AppleScript)

/bin/echo "${theAnswer}"

if [[ ${theAnswer} == "no" ]]

then /bin/echo "They obviously have read the Hitcherhiker's Guide and know it is 42"
else /bin/echo "The Answer is 42"
fi

exit 0


If you run this, it will echo out a response in terminal, just as a proof of concept of it running a command under the hood.



Please use at your own risk and make sure you test this a ton before putting it into production.



Thanks,
Tom


The only issue with that method is that Applescript will time out after 2 minutes. You can put a "giving up after 60" then put the pop-up window in a loop until it gets a response, but if the user walks away from the machine and the screensaver is enabled, then applescript will pause and eventually time out after 2 minutes even if you specify a longer time-out period.