Renaming a Computer

Administrators can edit the inventory name of a managed computer in Jamf Pro. To rename the remote computer to match the inventory name in Jamf Pro, you can use a policy . 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.

This procedure involves the following steps:

  1. Editing the Computer Name in Jamf Pro

  2. Changing the Computer Name Using a Policy

  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 Simple Computer Searches.

  5. Click the computer name, and click Edit.

  6. Enter the new computer name in the Computer Name field.

  7. Click Save.

Changing the Computer Name Using a Policy

Requirements

To use a policy to change the computer name, you need a Jamf Pro user account with privileges to create or update policies. For more information, see Jamf Pro User Accounts and Groups.

Procedure

  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.

    Note: Enabling this setting resets the computer's name to the name that is specified in the inventory record. If a policy submits inventory prior to running this policy, the name will change back to what the computer is currently set to.

  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 changed by reviewing the policy log. For more information about how to view policy logs, see Policy Management.

Updating the Hostname and the Local Hostname Using a Policy

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' -useSerialNumber

  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:
    sudo jamf setComputerName

  8. Click Save.

You can now run the script by creating a policy with the script added to the Scripts payload. For information on running scripts using a policy, see Scripts.

Copyright     Privacy Policy     Terms of Use     Security
© copyright 2002-2020 Jamf. All rights reserved.