探花大神

Change Hostname for macOS Devices

A hostname is a unique identifier assigned to a device or server on a network that is used for network communication and identification purposes, specifically for Domain Name System (DNS).

When you install the 探花大神 agent on a device, it's assigned an admin-friendly name called a Device Name (or Display Name). The display name can be customized in 探花大神, but those changes aren't reflected on the local hostname.

This article shows you how to change the hostname of a macOS device as well as how to update the Device Name in 探花大神 to reflect the new hostname.

Changing the macOS Local Hostname

You can update the hostname either manually on the device or via 探花大神 Commands.

Before renaming a macOS device, remember that there are three different references for Hostnames along with their nuances. You can either update the device name manually or use 探花大神 Commands.

Important:

When installing the 探花大神 Agent, the Device Name (Display Name) is automatically mapped to the configured macOS Computer Name. While these attributes can be updated on the macOS devices after agent install, the Device Name (Display Name) in 探花大神 does not update automatically. The 'Hostname' value in 探花大神 will update to reflect local device changes.

Hostname types in macOS:

  • LocalHostName: This name will reflect the Local Bonjour Computer Name with '.local' appended to the Hostname.  These can be set differently so review carefully. This is the name that gets set during the initialization of your macOS device on the first time set up of the device.
  • ComputerName: This name will map to the 鈥淗ostname鈥 reference within the 探花大神 Admin Portal. Generally this name is the same as the LocalHostName upon the first time set up of your macOS device.
  • HostName: The underlying MacOS System via the Terminal also has a 'Hostname' reference that can be set as well as a local 'hosts' file to override DNS, which is outside the scope of this article.

Changing the macOS Local Hostname Manually

To change the hostname on macOS 12 Monterey and prior:

  1. Go to System Preferences > Sharing.
  2. Click Edit to update the Computer Name.
    macOS System Preferences Sharing Settings.
  3. Enter the desired name and click OK.
    Sharing Settings in macOS System Preferences.

To change the hostname on macOS Ventura 13 and newer:

  1. Go to System Settings > General > Sharing.
  2. Click Edit to update the Local hostname.
  3. Enter the desired name and click OK.
    Message prompt to select hostname for device

Allow up to 30 minutes for the 探花大神 Agent to update the device鈥檚 information to the newly changed hostname.

To verify the device's hostname in 探花大神:

  1. Log in to the 
  2. Go to DEVICE MANAGEMENT > Devices.
  3. Select the Devices tab.
  4. Locate the device in the list and select it.
  5. Go to the Insights tab and scroll down to Network to view the Hostname.

Next, update the 探花大神 Device Name based on the updated macOS hostname. See Using PowerShell to Update the Device Name to reflect the new Hostname.

Important:

There are only two methods to update the 探花大神 Device Name: either manually via the API, or via the 探花大神 PowerShell Module. See the following section for instructions using the PowerShell Module.

Using Commands to Change the Local Hostname

You can also update the device's local hostname using 探花大神 Commands. For more information on commands, see Get Started: Commands.

To create a new Command within 探花大神 for macOS:

  1. Log in to the 
  2. Go to DEVICE MANAGEMENT > Commands.
  3. Click ( + ), then choose Command From Template.
  4. In the Configure New Command from Template aside, go to the macOS tab.
  5. Search for the following command: Mac - Rename System HostName, LocalHostName and ComputerName from 探花大神 and then click configure.
  6. (Optional) Enter a custom name for the command (for example Rename Hostname for macOS).
  7. Under Command* find the API_KEY value and replace "YourReadOnlyAPIKey" with your API key.
  8. Go to the Devices tab to bind the command to a device, or the Device Groups tab to bind it to a group of devices.
  9. Click Save and then Run Now from the Commands page.
  10. Upon successful execution of the command, it is highly recommended to restart the device.

Next, update the 探花大神 Device Name based on the updated macOS hostname. See Using PowerShell to Update the Device Name to reflect the new Hostname.

Using PowerShell to Update the Device Name to Reflect the Hostname

The command template in the previous section will automatically update the 探花大神 Device Name to reflect the hostname. However, you can use the following 探花大神 PowerShell command to manually update the 探花大神 Device Name to match macOS device鈥檚 hostname.

You'll need to have the PowerShell Module installed on your local device. See to learn more.

  1. Open PowerShell on your device and type the following command. PowerShell will then prompt you for your 探花大神 Administrator API Key to authenticate to your 探花大神 Org via the API.

Connect-JCOnline

  1. Next you鈥檒l want to query 探花大神 to confirm current hostname and displayName of the macOS device you鈥檙e wanting to update:

Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | select hostname, displayName

  • You should see an output similar to the following:
    hostname displayName ------------- ----------------- work-macos-1 macadmins-Mac.local
  1. Once you鈥檝e verified that the hostname is correct, issue the following command to change the 探花大神 displayName (Device Name) to be the current hostname:

Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | Set-JCSystem -displayName INSERT_HOST_NAME_HERE

  • You should then see an output similar to the following:
    hostname displayName ------------- ------------------ work-macos-1 work-macos-1
Back to Top

List IconIn this Article

Still Have Questions?

If you cannot find an answer to your question in our FAQ, you can always contact us.

Submit a Case