Hi Folks,
I cobbled together the following script to allow standard users to name their assigned device. The script needs to be applied to a Self Service Item for it to work properly. (i.e. it's run as root). When run, it queries the student for their A. Initials and B. their student number. It then builds the name by combining the data with the device serial number using the JAMF Binary.
#!/bin/bash
# must be run as root on selected devices through a Self Service Item
# Script to query student for Initials and ID numbers and create
# a string in the format XX-111111-SERIALNUMBER
# then set the computer name to that string
# Get information from user
keyPress=`
/usr/bin/osascript <<EOT
tell application "Self Service"
activate
display dialog "Please enter your Initials in UPPERCASE LETTERS" default answer ""
set myInitials to text returned of result
display dialog "Please enter your Student ID Number" default answer ""
set myID to text returned of result
set computerName to myInitials&"-"&myID&"-"
end tell
EOT`
# Set Computer Name
jamf setComputerName -target / -useSerialNumber -prefix $keyPress