Computer Name - Please Explain


Hey Community,

Can someone enlighten me on the following:

  • Computer Name
  • Host Name
  • Local Host Name
  • Computer ID - under AD binding

If I recall correctly the Computer ID ties into Host Name.

If I recall correctly the Local Host Name will automatically change if the computer thinks there is a similar name on the network.

Thanks in advance!


Valued Contributor II

Taken from the scutil man page:

ComputerName The user-friendly name for the system. LocalHostName The local (Bonjour) host name. HostName The name associated with hostname(1) and gethostname(3).

Esteemed Contributor III

ComputerName (UNIX) = Computer Name (GUI)
LocalHostName (UNIX) = Local Hostname (GUI)
HostName (UNIX) = defined by DNS (often wrong)

Just a thought, since this is one of the things that gets me bent out of shape. Seeing computers that are bound to AD where the AD object does not match Computer Name. Not sure how many problems that can cause, but to fix that you'd have to unbind the computer from AD, and re-bind so the AD object matches the Computer Name.

As far as setting HostName, I've always taken the position to not do that. Users just need to understand, Terminal will display what DNS believes your Computer Name is. My Windows colleagues are so used to saying "host name" that it gets interpreted by Mac techs as "HostName" and the next thing you know techs are setting HostName. #FacePalm

Not for nothing, but setting HostName can cause problems with P4, where a developer would lose access to their projects that for some odd reason is bound to their Hostname. We alerted the developer, but they seem firm on their position, that developers should only work on computers that have FQDN (so no chance HostName will ever change).

Sorry for the rant. :)



Contributor III

Any chance someone has already written an EA to check to make sure the names match?


Thank you all for responding and the explanation.

@donmontalvo no worries on the rant! Thank you for sharing. For some reason, I thought the Computer ID under Directory Bindings was tied to HostName.

I did experience the issue earlier this year where our Computer ID's were longer than the NetBios Names for AD. Thus, when trying to bind them using Casper, the bind would fail, causing the computers to kick off its neighbor when it bound. The computers have a similar naming structure in our lab this it would cut anything off after the 15th Character. So, keep this in mind when using Casper to bind machines to AD.

So, I changed the Naming Convention, set it in Casper and then created a policy to enforce the new names. Well, that all went great! However, the Computer ID did not change because the HostName (I believe this is correct) is not updated. Thus, I had to manually unbind them from AD, update their names using terminal, and then re-bind. At some point I will need to request a feature for Casper to update the Computer ID when the Host Name is updated.

Esteemed Contributor III
# Check ComputerName
echo "<result>`scutil --get ComputerName`</result>"
# Check HostName
echo "<result>`scutil --get HostName`</result>"
# Check LocalHostName
echo "<result>`scutil --get LocalHostName`</result>"
# Check AD Bind name
echo "<result>`dsconfigad -show | grep "Computer Account" | awk '{print $4}' | rev | cut -c 2- | rev`</result>"
# Check AD name mismatch
COMPUTER_NAME="`scutil --get ComputerName`"
AD_NAME="`dsconfigad -show | grep "Computer Account" | awk '{print $4}' | rev | cut -c 2- | rev`"
if [ $COMPUTER_NAME == $AD_NAME ]; then
echo "<result>MATCH</result>"
echo "<result>MISMATCH</result>"