Computer name changing when binding to Domain

New Contributor

I am fairly new to managing Macs with JAMF. We are attempting to both name and bind the computers to AD with policies during enrollment. The issue we run into is, our naming script works, however, when the computers bind to the domain the NetBIOS name reverts to something different from the LocalHostName which causes the computers to bind to the domain under a different name. Here is the script we are using to name the computers:


defaults write /Library/Preferences/ NoMulticastAdvertisements -bool YES

computerName=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')


echo $prefix$computerName

scutil --set HostName $prefix$computerName

scutil --set LocalHostName $prefix$computerName

scutil --set ComputerName $prefix$computerName

jamf Recon


Any help or insight would be greatly appreciated!



Contributor III

If bound, I suggest you unbind the Machine first with unbinding script, Then try this [](link URL) the final piece of the script will bind the machine after the naming with the binding policy of your own. Please note that this uses CSV, but thats an option, you can use serial numbers to, prefixes, and suffixes.

New Contributor

That worked! Thank you very much for your help!

New Contributor II

If you are just looking for serial numbers as the computer name this is a great tool to use.


jamf setComputerName -target / -useSerialNumber