I need help with a script to change computer name. I am using the DEPNotify Starter 2.0.1 script. I am using the Popup 3 label for the list of University Campus, Popup 1 label for the building, and would like to use the last seven of the serial number. If Campus is New York, and the building is Central Hall and the serial number of machine is 1234567, I would like that translated to NYCH1234567
I am currently using the script as a policy in DEPNotify policy array with a custom trigger. I would like to make it that as the User/Tech selects their Campus and the Building the device is assigned to, that it will use that as part of the computer naming along with the 7 digits of the serial number.
!/bin/sh
set serial variable
serial=/usr/sbin/system_profiler SPHardwareDataType | /usr/bin/awk '/Serial Number (system)/ {print $NF}'
appendserial=echo "${serial:5}"
fordhamname=APPLE${appendserial}
/usr/sbin/scutil --set ComputerName "${apple}"
/usr/sbin/scutil --set LocalHostName "${apple}"
/usr/sbin/scutil --set HostName "${apple}"
exit 0
Can anyone make any suggestions, or like previous requests, does anyone have anything similar to what I am looking to do?
I would really appreciate the help.