macOS renaming itself...

pchrichard
Contributor

We use a script to rename our Macs along the lines of DA-%SERIALNUMBER%

For the last year or so, around half of our estate (I expect those using our campus network) regularly renames itself along the line of DA-FVFHF4BGQ05F (6), the suffix number incrementally increases and we have some devices with hostnames that end (533) or greater. This obviously looks a total mess.

I don't fully understand why this happens, nor how to prevent it - I presume it relates to the device wanting to avoid a duplicate name on the network, which in our case would only be itself, so it's confusing why it happens at all.  WIndows isn't affected in the same way. I suspect the ultimate fix would be something at network level, but wonder if anyone knew the root cause, or had dealt with this via macOS config and/or Jamf?

5 REPLIES 5

patrickj
New Contributor III

Do any of these devices happen to use multiple connection types? For example Wi-Fi and an Ethernet adapter on the same network? I've seen instances where it can cause a hostname conflict.

pchrichard
Contributor

Hi Patrick, thanks for this.  Upon investigation, it does appear that all Macs affected are using both ethernet and wifi... is there anything configurable in MacOS to ignore this hostname conflict?

jtrant
Valued Contributor

I don't think there's a way around this behavior, but I set up an EA to check if the hostname was valid, and if not, rename the Mac once a week.

Happy to provide both but we name our systems to S/N so it might not be too useful.

Gratti
New Contributor

Hey Jrant, would you be able to provide me with that script as well? We're seeing the same issue in our environment.

pchrichard
Contributor

Thanks, jtrant - sounds useful, could you send over your script?