Do you have your asset tags listed against the serial number in a database somewhere? We query the our asset DB with the serial number and it returns the asset tag along other information (we actually have the machine name in there as well).
We don't, up until High Sierra we were using DeployStudio and we could supply it with hostname mapped to serial number. Unsure of how we can do that with JAMF.
Thanks for the reply.
One tactic I went with before we went to just using the serial number was to create separate Prestage enrollments for each machine by cloning, changing the AD name each time to match the asset tag, and then having a policy rename the computer according the the AD name.
If that is infeasible, you can create an API account and have the computer look up its asset tag.
Relevant excerpts for looking up the asset tag via the API:
#!/bin/bash
serialnum=$(/usr/sbin/ioreg -c IOPlatformExpertDevice -d 2 | /usr/bin/awk -F" '/IOPlatformSerialNumber/{print $(NF-1)}') || { /bin/echo "Failed to get serial number."; exit 1; };
compinfopath=$(/usr/bin/mktemp -t ${serialnum}) || { /bin/echo "Failed to create info file."; exit 1; };
/usr/bin/curl -s -S -K -H "Accept: application/xml" -u apiusername:apipasswd "${jss_url}JSSResource/computers/serialnumber/${serialnum}/subset/Location&Extension_attributes" -o "${compinfopath}" || { /bin/echo "Failed to pull inventory info."; exit 1; };
assettag=$(/usr/bin/xmllint --xpath '/computer/general/asset_tag' ${compinfopath} | /usr/bin/awk -F '<[a/]+sset_tag>' '{print $2}');