Posted on 04-05-2018 08:17 AM
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/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,
Posted on 04-05-2018 10:03 AM
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.
Posted on 04-06-2018 06:41 AM
That worked! Thank you very much for your help!
Posted on 04-09-2018 02:25 PM
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