I am trying to get a script working for Prestage Enrollment. It's supposed to pop up a window where you can enter the asset tag. Works when I use a custom trigger from the terminal, but not recurring check in or on enrollment. When run during enrollment, the window never pops up so not able to enter anything in and it goes ahead and binds with whatever the computer is named.
Script:
#!/bin/sh
/bin/sleep 60
computerName=$(osascript -e 'Tell application "System Events" to display dialog "Please enter computer name and click Submit:" default answer "" buttons {"Submit"} with icon caution' -e 'text returned of result' 2>/dev/null)
/usr/sbin/scutil --set ComputerName $computerName
/usr/sbin/scutil --set LocalHostName $computerName
/usr/sbin/scutil --set HostName $computerName
echo "Computer name has been set..."
/usr/bin/yes | /usr/sbin/dsconfigad -add xxxx.xxx -u username -p password -groups "XXXXComputer Technicians,XXXXDirector of Information Systems,XXXXIT Engineers" -computer ${computerName} -shell /bin/bash -ou "CN=Computers,DC=xxxx,DC=xxx"
echo "Binding to AD"
/bin/sleep 30
dscacheutil -flushcache
echo "<result>`scutil --get ComputerName`</result>"
jamf recon
exit 0