Way to record user chosen options in JAMF helper

aRByCM
New Contributor

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.

5 REPLIES 5

DBrowning
Valued Contributor II

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

AJPinto
Honored Contributor III

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

 

 

aRByCM
New Contributor

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?

DBrowning
Valued Contributor II

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.  

Thanks for this info, I'll try your suggestion.