Missing host/device name after joining domain.

New Contributor

I've been having issues 10.8 and up that after I image the first time a network account logs into the machine the hostname and device name gets blanked off the machine. Once I put it back in it will stay. My 10.6 and 10.7 images aren't affected.

Has anyone else experienced this?


New Contributor III

@TheSeans - I have not had this problem in particular, but did find out the hard way that if you enable the "Reset Computer Names" option in policies, it will set the hostname on the systems to localhost and inventory this way as well.

Additionally, 10.8.3 has a bug in it in which moving the object in AD causes the object to no longer find the record and you can no longer perform domain authentication. Putting the object back in the original OU/Container does not solve the problem. All you can do is rebind the system to the domain. This was fixed in 10.8.4.

Contributor III

I don't think it loses the hostname after joining the domain, I don't think the hostname gets applied correctly after it's first reboot from Casper Imaging. I also had this happen with my 10.8 computers. I have a policy that runs first after imaging that does this:


## Location of Preference Plist 

## Grabs ComputerName from the Plist
if [ -f $pref_file ]; then
    set_name=`defaults read /Library/Preferences/SystemConfiguration/preferences | grep ComputerName | head -1 | awk '{print$3}' | sed 's/;//'`
    echo "[ set_name ] :: Can't find the preferences.plist file... aborting"
    exit 1

/usr/sbin/networksetup -setcomputername $set_name
scutil --set ComputerName $set_name
scutil --set HostName $set_name
scutil --set LocalHostName $set_name

exit 0

I don't remember if I wrote this or I found it online somewhere, but this will fix your issue. If someone else recognizes this please let me know who the credit goes to. Hopefully this helps. Thanks!