We rename our machines at enrollment based off of a user choice in DEPNotify to see if it is a shared, primary, or test machine, SerialNumber-(S/P/T). This choice is used to easily identify a machine based on usage, as well as smart group/policy scoping.
We name machines with the following script:
#!/bin/sh scutil --set HostName "$SerialNumber" scutil --set LocalHostName "$SerialNumber" scutil --set ComputerName "$SerialNumber" defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName "$SerialNumber" "$JAMF_BINARY" setComputerName -name "$SerialNumber" echo "Machine name set to $SerialNumber"
Even with this machines are still renaming to default macOS names with "MacBook Pro", "Mac Pro", "'usernames' MacBook Pro".
I had read the article from https://mrmacintosh.com/10-15-4-supplemental-update-resets-computername-hostname-to-default/
and this does not seem to be the issue as this is happening to fully up to date 10.15.7 machines on a recurring basis.
Has anyone else seen this issue within Catalina, as well as Mojave on a few instances? We are now running a script at recurring check-in to see if the machine name contains the serial number, and if not, updates it again as it has been occurring so often and causes certificate issues.