Hello all,
I’m trying to set up a script to prompt our Tier 1 techs to rename the computer when they set it up out of the box for the first time. While it changes the local name, HostName (aka NetBios), and computer name according to terminal, the NetBIOS name change is not reflected in the GUI (System Preferences > Network > Adapter 1, Adapter 2, etc).
Since a number of things around here, such as Identity Finder, rely on the NetBIOS name, this is a problem for us.
Here’s what I’ve got so far:
#!/bin/bash
#Prompts for computer name
ComputerName=`/usr/bin/osascript << EOT
tell application "System Events"
with timeout of 345600 seconds
activate
set ComputerName to text returned of (display dialog "Please Input New Computer Name (XX-XXXXXX)" default answer "XX-" with icon 2)
end timeout
end tell
EOT`
#Set New Computer Name
echo $ComputerName
sudo scutil --set LocalHostName $ComputerName
sleep 1
sudo scutil --set ComputerName $ComputerName
sleep 1
sudo scutil --set HostName $ComputerName
sleep 1
exit 0
They only time I’ve gotten the adapters to report the correct NetBIOS name is when I bind it to the domain. But as soon as I unbind it, it reverts to D-XXX-XX-… name based off of IP address. Is there a way for that to stay the same?