I posted previously asking if it's possible to add more text fields to DEPNotify. It doesn't seem possible, so after getting some input from others here in Jamf Nation, I wrote this script that uses osascript to prompt for the user (or whoever is setting up the Mac) to give the user's full name and email address. The script works when ran as a normal policy on check-in, and I just got it to work on enrollment. What I was hoping to do was to add it to the policy array in DEPNotify. When I do this, I see that the policy containing the script is running, but I never see the prompt appear. Eventually, the osascript prompt will just time out while DEPNotify is running. Am I wasting my time with this? Is it even possible to have osascript display a message while DEPNotify is running? Script is below:
#!/bin/sh
#Prompts for the user's full name and email address then sends the submitted information to the Mac's inventory in User and Location.
#Prompt user for their name.
nameSubmitted=$(osascript -e 'Tell application "system events" to display dialog "Please enter your name. When prompted, please enter your email address. These will be included in the inventory record for your Mac." default answer "" buttons {"Continue"} default button "Continue"')
echo $nameSubmitted
#Prompt user for their email address.
emailSubmitted=$(osascript -e 'Tell application "system events" to display dialog "Please enter email address." default answer "" buttons {"Continue"} default button "Continue"')
echo $emailSubmitted
#Convert the results from user inputs to a form usable by Jamf Pro.
realName=$(echo $nameSubmitted | sed 's/button returned:Continue, text returned://')
echo $realName
emailAddress=$(echo $emailSubmitted | sed 's/button returned:Continue, text returned://')
echo $emailAddress
#Send the user's name and email address to the Mac's inventory record. Use double quotes for realName to capture first and last name entered by the user.
jamf recon -realname "$realName"
jamf recon -email $emailAddress
