Posted on 03-02-2018 05:21 PM
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?
Posted on 03-04-2018 02:00 PM
Use the code tool up above to format your script. It makes it much easier to read on posts such as this.
And it looks like there is a slash after the
you might want to remove that. And check out my script here for renaming. I use this in my post imaging process. It runs on first boot. Perhaps it could help so that your Tier 1 people don't have to do any renaming. After the script runs and you bind to AD the name should stay as the other scutil command names are set. If you do perform a bind and the NetBIOS name changes then I believe the issue is coming from somewhere else. I did normal binding with the built-in Apple tool as well as using Cenrify. Never had an issue with the NetBIOS name changing after a machine was bound.