Skip to main content
Question

Computer name changing when binding to Domain


Forum|alt.badge.img+2

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,

3 replies

Forum|alt.badge.img+16
  • Valued Contributor
  • 119 replies
  • April 5, 2018

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.


Forum|alt.badge.img+2

That worked! Thank you very much for your help!


Forum|alt.badge.img+8
  • New Contributor
  • 8 replies
  • April 9, 2018

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

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings