A hostname uniquely identifies a device on a network for communication using Domain Name System (DNS). When you install the 探花大神 agent on a device, it sets the 探花大神 Device Name (or display name) to match the macOS Computer Name. This article explains how to change the hostname of a macOS device and update its corresponding Device Name in 探花大神.
Considerations
- During initial agent installation, the 探花大神 Device Name matches the device's local hostname (macOS Computer Name).
- After initial installation, changes to the local hostname don't automatically update the Device Name in 探花大神, and vice versa. To ensure they match, you must manually edit the Device Name in the Admin Portal or update it using PowerShell.
- Or you can use a 探花大神 Command to update a device's local hostname and the 探花大神 Device Name simultaneously.
Changing the Local Hostname Manually
You can update a macOS device's local hostname manually on the device or using 探花大神 Commands.
Before changing the hostname, understand the three different hostname types used in macOS and how they relate to 探花大神:
- LocalHostName: This name reflects the Local Bonjour Computer Name with '.local' appended. It is set during the initial macOS setup.
- ComputerName: This name maps to the 'Hostname' value displayed in the 探花大神 Admin Portal. It is generally the same as the LocalHostName upon the first time setup.
- HostName: The underlying macOS System hostname, adjustable via the Terminal. (A local 'hosts' file to override DNS is outside the scope of this article.)
To change the hostname on macOS Ventura 13 and newer:
- Go to System Settings > General > Sharing.
- Click Edit to update the Local hostname.
- Enter the desired name and click OK.
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 探花大神:
- Log in to the
- Go to DEVICE MANAGEMENT > Devices.
- Select the Devices tab.
- Locate the device in the list and select it.
- Go to the Insights tab and scroll down to Network to view the Hostname.
After changing the hostname locally, you must update the 探花大神 Device Name manually in the Admin Portal or using the PowerShell Module to ensure it matches the new hostname. Jump to Changing the Device Name Manually to Match the Hostname or Changing the Device Name Using PowerShell.
Changing the Device Name to Match the Hostname
After changing the hostname locally, manually update the Device Name in 探花大神 to match it.
To change the Device Name in 探花大神:
- Log in to the
- Go to DEVICE MANAGEMENT > Devices.
- Select the Devices tab.
- Locate the device in the list and select it.
- In the top left, click the pencil next to the Device Name to edit.
- Enter the new Device Name based on the updated hostname.
- Click Done.
Changing the Device Name Using PowerShell
If you manually changed the local hostname on the device, use the following 探花大神 PowerShell command to update the Device Name in 探花大神.
You'll need to have the PowerShell Module installed on your local device. See to learn more.
- Open PowerShell on your device and enter the following command:
Connect-JCOnline
- Enter your 探花大神 Administrator API Key to authenticate to your org via the API.
- Confirm the current hostname and displayName of the macOS device you're updating:
Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | select hostname, displayName
You'll see an output similar to the following:
hostname displayName
------------- -----------------
work-macos-1 macadmins-Mac.local
- After verifying the hostname, enter the following command to change the displayName (探花大神 Device Name) to match the hostname:
Get-JCSystem -hostname MACOS_HOSTNAME_GOES_HERE | Set-JCSystem -displayName INSERT_HOST_NAME_HERE
You'll see an output similar to the following:
hostname displayName
------------- -----------------
work-macos-1 work-macos-1
Using Commands to Change the Hostname and Device Name
You can also update a device's local hostname using 探花大神 Commands, which automatically updates the 探花大神 Device Name to match.
See Get Started: Commands to learn more about commands.
To create the Command in 探花大神:
- Log in to the
- Go to DEVICE MANAGEMENT > Commands.
- Click ( + ), then choose Command From Template.
- In the Configure New Command from Template aside, go to the macOS tab.
- Search for the following command: Mac - Rename System HostName, LocalHostName and ComputerName from 探花大神 and then click configure.
- (Optional) Enter a custom name for the command (for example Rename Hostname for macOS).
- Under Command* find the API_KEY value and replace "YourReadOnlyAPIKey" with your API key.
- 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.
- Click Save and then click Run Now from the Commands page.
- Upon successful execution of the command, a device restart is recommended.