How I did it, is post image the name got sent to a text file
bash-3.2# networksetup -getcomputername > /Library/Receipts/cname.txt
bash-3.2# cat /Library/Receipts/cname.txt
205admin’s iMac
bash-3.2#
then the file cname.txt would be used later to check against the name
daily in a script
setName=cat /Library/Receipts/cname.txt
currentName=networksetup -getcomputername
if [[ ${setName} != S{currentName} ]]
then echo "wrong name found, changing..."
scutil --set Computername ${setName}
scutil --set LocalHostName ${setName
echo "naming convention fixed...
else echo "No problem found...exiting.."
fi
exit 0
I just wrote that really fast with out checking syntax or testing it,
so please test it before you attempt to use it. The idea is you have
the commands up top run at post imaging time to put it to the client,
because once the unit recons with the different name the name in Casper
will be changed. That is why I cache it to a local file.