Posted on 06-12-2023 11:25 PM
I'm using JAMF helper to display a message on the users and I have set two buttons named "Yes" and "No" (it doing nothing as of now), i'm asking if there is a way to record what button user clicked and report it to jamf pro? or record it on the users laptop and get it later.
Posted on 06-13-2023 04:18 AM
Return Values: The JAMF Helper will print the following return values to stdout...
0 - Button 1 was clicked
1 - The Jamf Helper was unable to launch
2 - Button 2 was clicked
3 - Process was started as a launchd task
XX1 - Button 1 was clicked with a value of XX seconds selected in the drop-down
XX2 - Button 2 was clicked with a value of XX seconds selected in the drop-down
239 - The exit button was clicked
243 - The window timed-out with no buttons on the screen
250 - Bad "-windowType"
255 - No "-windowType"
would also suggest taking a look at this how to use jamfHelper doc. https://hcsonline.com/images/How_to_use_Jamf_Helper.pdf
Posted on 06-13-2023 04:42 AM
You can setup an if statement and echo the user choice to the JAMF logs. Below is what I use in a larger script if you wanted an example.
#Running JAMF Helper
userChoice=$("$jamfHelper" -windowType "$windowType" -title "$title" -heading "$heading" -description "$description" -defaultButton "$defaultButton" -cancelButton "$cancelButton" -icon "$icon" -iconSize "$iconSize" -alignHeading "$alignHeading" -button1 "$button1" -button2 "$button2")
#Rebooting device or canceling based on user choice
if [ "$userChoice" == "0" ]; then
echo "User clicked Acknowledge, Opening Software Update Preference Pane."
open -b com.apple.systempreferences /System/Library/PreferencePanes/SoftwareUpdate.prefPane
exit 0
elif [ "$userChoice" == "2" ]; then
echo "User clicked Cancel; now exiting."
exit 1
fi
Posted on 06-13-2023 07:42 PM
Thanks for taking time to reply, @AJPinto thanks for this example this will be useful to me in the future.
@DBrowning I understand the return values, but can JAMF record the return values, so I can know which button the user clicks?
Posted on 06-14-2023 04:00 AM
You would have to echo it in your script and then look at the policy logs to view it. Another option would be to have your script write the value to an extension attribute.
Posted on 06-15-2023 08:50 PM
Thanks for this info, I'll try your suggestion.