The prefix is showing up on the device, but it's not pulling down the serial. I've even tried a few commands I've seen on these forums, and it still won't grab the serial. I am learning scripting, and only know basic commands. I took over for the previous sys admin who left, and he could never get the script to work either.
MODEL=$(sysctl hw.model)
if [[ $MODEL == *"Book"* ]]
then
PREFIX="TRML-"
else
PREFIX="TRM-"
fi
SERIAL=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformSerialNumber/{print $7}')
COMPUTERNAME="${PREFIX}${SERIAL}"
/usr/sbin/scutil --set ComputerName $COMPUTERNAME
/usr/sbin/scutil --set LocalHostName $COMPUTERNAME
/usr/sbin/scutil --set HostName $COMPUTERNAME