Hi,
We have a policy that is set up to rename the computer if it is not already named using the school's naming convention and is in the school's smart group. The trigger is at check-in. The setting, " Force computers to submit updated inventory information to the JSS" has been enabled. It worked initially but has not been applying to the client for some time now. I have tried forcing the policy through the terminal and reimaging. I have tried to troubleshoot the issue but have not been able to see if the issue is with the policy, script, or the device.
The script is posted below. Does anyone have any suggestions?
!/bin/sh
ensure this is run as root
if
[ whoami != root ]
then
echo Please run this script as root or using sudo
exit
fi
check of computer is already bound to domain
domain="k12.us" current=$( dsconfigad -show | awk '/Active Directory Domain/{print $NF}' )
if [[ "${domain}" == "${current}" ]]; then
echo Computer already bound to AD
exit
fi
Set a variable with the last 7 digits of SN
L7SN=/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial/ { print $NF }' | tail -c 9
Is this a portable? 0 = no, 1 = yes
BOOK=/usr/sbin/system_profiler SPHardwareDataType | awk '/Model Name/' | grep Book | wc -l
Set system name variable based on the above two variables
if [ $BOOK == 1 ]
then
NAME=7366STL$L7SN
else
NAME=7366STD$L7SN
fi
Set Computer name based on Variable
/usr/sbin/scutil --set ComputerName $NAME
/usr/sbin/scutil --set HostName $NAME
/usr/sbin/scutil --set LocalHostName $NAME
