I’m managing macOS devices in Hexnode and need to change the computer name/hostname of a Mac. I was looking for a remote action to rename the device, but I can’t find a direct option for macOS. Is there a way to do this from Hexnode?
I’m managing macOS devices in Hexnode and need to change the computer name/hostname of a Mac. I was looking for a remote action to rename the device, but I can’t find a direct option for macOS. Is there a way to do this from Hexnode?
For macOS devices, the hostname cannot be changed directly using the standard Hexnode remote actions.
The recommended approach is to deploy a custom script to the Mac. A typical rename script sets the macOS ComputerName, LocalHostName, and HostName values using scutil.
Example:
|
1 2 3 4 5 6 7 8 9 10 |
bash#!/bin/bash newName="<new-hostname>" /usr/sbin/scutil --set ComputerName "$newName" /usr/sbin/scutil --set LocalHostName "$newName" /usr/sbin/scutil --set HostName "$newName" /usr/bin/dscacheutil -flushcache |
Replace <new-hostname> with the required name, then deploy the script to the target macOS device from Hexnode using the custom script deployment option.
Note: LocalHostName should not contain spaces or unsupported special characters. If the computer name has spaces, use a simplified version for LocalHostName.
Regards,
Mary Romero
Don't have an account? Sign up