Skip to main content
Jamf Nation, hosted by Jamf, is the largest Apple IT management community in the world. Dialog with your fellow IT professionals, gain insight about Apple device deployments, share best practices and bounce ideas off each other. Join the conversation.

Updating the Computer Name of Managed Computers

Overview

Administrators can edit the inventory name of a managed computer in Jamf Pro. Later, to rename the remote computer to match the inventory name in Jamf Pro, use a policy or Jamf Remote. To rename a remote computer using a policy, configure the Maintenance payload and select the Reset Computer Names checkbox. When changing the remote computer name, it is best practice to match the hostname and the local hostname of the computer by running a script with a policy. This allows other computers in the network to discover and connect to the computer in the DNS.

Products Affected

Jamf Pro 7.0 and later

Requirements

To use a policy to change the computer name, you need a Jamf Pro user account with privileges to create or update policies.

To use Jamf Remote to reset the computer name, you need the following:

  • A Jamf Pro user account with privileges to "Use Jamf Remote" and "Run Scripts Remotely"
  • Client computers accessible via the network, have Remote Login (SSH) enabled, and have a configured Jamf Pro management account.

Procedure

The procedure involves the following steps:

  1. Editing the Computer Name in Jamf Pro
  2. Renaming the Computer
    • Option 1: Changing the Computer Name Using a Policy
    • Option 2: Resetting the Computer Name Using Jamf Remote
  3. Updating the Hostname and Local Hostname Using a Policy

Editing the Computer Name in Jamf Pro

To rename the computer in Jamf Pro, you must edit the computer name in the inventory. Note: Before editing the computer name in Jamf Pro, verify that the current computer name matches the inventory name in Jamf Pro. The computer name can be found by navigating to the Apple menu > System Preferences > Sharing > Computer Name.

  1. Log in to Jamf Pro.
  2. Click Computers at the top of the page.
  3. Click Search Inventory.
  4. In the Search field, enter the computer name that you want to change. For more information, see the Simple Computer Searches page in the Jamf Pro Administrator's Guide.
  5. Click the computer name, and click Edit.
  6. Enter the new computer name in the Computer Name field.
  7. Click Save.

Renaming the Computer

Option 1: Changing the Computer Name Using a Policy

  1. Log in to Jamf Pro.
  2. Click Computers at the top of the page.
  3. Click Policies.
  4. Click New.
  5. Use the General payload to configure basic settings for the policy, including the trigger and execution frequency.
  6. Use the Maintenance payload to choose basic settings for the policy, including the Reset Computer Names checkbox.
  7. Click the Scope tab and configure the scope of the policy.
  8. Click Save button.

The policy runs on computers in the scope the next time they check in with Jamf Pro and meet the criteria in the General payload.
Note: You can verify that the computer name was changed by reviewing the policy log.

Option 2: Resetting the Computer Name Using Jamf Remote

  1. Open Jamf Remote and authenticate to the Jamf Pro server.
  2. Click Site and choose a site. This determines which items are available in Jamf Remote.
  3. In the list of computers, select the checkbox for the computer you want to rename.
  4. Click the Advanced tab.
  5. Select the Reset Computer Names checkbox.
  6. Do one of the following:
    • To immediately perform the tasks on the specified computers, click Go.
    • To schedule the tasks to take place at a specific day and time, click Schedule and choose a day and time. Then click Schedule again.

Note: You can verify that the computer name was reset by reviewing the policy log.

Updating the Hostname and the Local Hostname Using a Policy

To update the hostname 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.

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.

Creating a Script to Update the Hostname and the Local Hostname

  1. Log in to Jamf Pro.
  2. In the top-corner of the page, click Settings.
  3. Click Computer Management.
  4. Click Scripts.
  5. Click New.
  6. Use the General pane to configure basic settings for the script, including the display name and category. Note: If you do not add the script to a category, Jamf Admin displays the script in blue text in the Unknown category.
  7. Click the Script tab and enter the following in the script editor, modifying it for your environment:
#!/bin/bash
# get Computer Name
computerName=$( /usr/sbin/scutil --get ComputerName )
echo "Computer Name: $computerName"

# create network name using only alphanumeric characters and hyphens for spaces
networkName=$( /usr/bin/sed -e 's/ /-/g' -e 's/[^[:alnum:]-]//g' <<< "$computerName" )
echo "Network Name: $networkName"

# set hostname and local hostname
/usr/sbin/scutil --set HostName "$networkName"
/usr/sbin/scutil --set LocalHostName "$networkName"

exit 0

8. Click Save.

Updating the Hostname and the Local Hostname Using a Policy

  1. Log in to Jamf Pro.
  2. Click Computers at the top of the page.
  3. Click Policies.
  4. Click New.
  5. Use the General payload to configure the display name and execution settings.
  6. Use the Scripts payload to add the script you created and configure the settings.
  7. Click the Scope tab and configure the scope of the policy.
  8. Click Save.

The policy runs on computers in the scope the next time they check in with Jamf Pro and meet the criteria in the General payload.
Note: You can verify that the computer name was updated by reviewing the policy log.

Like Comment
Order by:
SOLVED Posted: by Sean_Ginn

Does this also work for the .local name or does that have to be changed locally?

Like
SOLVED Posted: by kidtrebor

Hi,

If the computer is bound to Active Directory will this update the object name?

Like
SOLVED Posted: by Mhomar

I have the same question as @kidtrebor , "If the computer is bound to Active Directory will this update the object name?" I suspect it will not? anybody know for sure?

Thanks!

Like
SOLVED Posted: by RC408

It will not update the AD record.

Like
SOLVED Posted: by palmeida

Outdated navigation directions. There is no longer an advanced tab. Please update

Like
SOLVED Posted: by ebonweaver

Numerous errors being this is 6 years old and never updated....

Like