Skip to main content

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:



!/bin/sh



defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES



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



prefix=$"M-"



echo $prefix$computerName



scutil --set HostName $prefix$computerName



scutil --set LocalHostName $prefix$computerName



scutil --set ComputerName $prefix$computerName



jamf Recon



exit



Any help or insight would be greatly appreciated!



Thanks,

If bound, I suggest you unbind the Machine first with unbinding script, Then try this [https://github.com/TravellingTechGuy/renameMacCSV](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.


That worked! Thank you very much for your help!


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



#!/bin/sh

jamf setComputerName -target / -useSerialNumber