To update the hostname, computer name, and the local hostname, you need to create a script that includes the new computer name. Then, you can run the script using a policy. The command used in this script can update computers dynamically when DNS services are configured on the network.
When updating the hostname and the local hostname, use the following guidelines:
Use a hyphen instead of spaces.
The only special character you can use is a hyphen.
Case is not sensitive.
Non-alphanumeric characters are ignored.
You can also add the following options to the command used in the script:
- -target <target volume>
Sets the name when the computer is booted to the specified target volume
- -name <name>
The new name for the computer
- -useMACAddress
Changes the name to the primary MAC address
- -useSerialNumber
Changes the name to the serial number
- -suffix <suffix>
Adds this suffix to the MAC address or serial number. For example:
sudo jamf setComputerName -useMACAddress -suffix '-example'- -prefix <prefix>
Adds this prefix to the MAC address or serial number. For example:
sudo jamf setComputerName -useMACAddress -prefix '-example'- -fromFile <file path>
The path to a CSV file containing the computer's MAC address or serial number, followed by the new name. For example:
sudo jamf setComputerName -fromFile '/file/path'
- In Jamf Pro, click Settings in the sidebar.
- In the Computer management section, click Scripts .
- Click New.
- Use the General pane to configure basic settings for the script, including the display name and category.
- Click the Script tab and enter the following in the script editor, modifying it for your environment:
sudo jamf setComputerName - Click Save.
You can now run the script by creating a policy with the script added to the Scripts payload.