Skip to main content

When I image it seems as though only the computer name is getting set when I name a machine using the prompt in Casper Imaging.



I'm not sure if this is the expected behavior - but -my- expected behavior (maybe a bit misguided) is that it would not only set the Computer Name, but the hostname and the local hostname to match.



Am I way off here?

Can you please state what version of the OS you're trying to image and what version of the JSS you're on?


Absolutely - sorry for the omission.




  • 8.6

  • 10.7.4

  • Image based on Composer snapshot of 10.7.4


I ran into so many issues with this in the past due to Apple's auto-naming that I explicitly set all three to be the same, using scutil.


yeah, I do the same as alex. scutil in a script for the win on this one.


Sounds like a plan - since I've already got the computer name set correctly - do you guys just get the computer name and then set it as a variable (computername) in the script and run scutil --set HostName $computername ?


The 3 possible names that a Mac can have is one of the things I often get ribbed about by my fellow Windows colleague. They find it ridiculous that there can be 3 possible names, potentially all different in certain circumstances. I can't say I really blame them. A new OOB Mac setup sets all these the same, but in an imaging or managed environment they can get out of sync unless you do the scutil naming commands as mentioned above.


something like this perhaps...



# set the computer name
setName=networksetup -getcomputername
scutil --set ComputerName ${setName}
scutil --set LocalHostName ${setName}
scutil --set HostName ${setName}


#!/bin/sh

hostname=`jamf getComputerName | cut -c 16-34`
localhostname=`jamf getComputerName | cut -c 16-26`

echo "FQDN hostname will be set to $hostname"
echo "Local hostname will be set to $localhostname"

/usr/sbin/scutil --set HostName $hostname
/usr/sbin/scutil --set LocalHostName $localhostname

exit=0

So does



sudo jamf -setComputerName <some name or action>


Not work?


Not if the JSS's record has already been hosed up.


I use this ```
scutil --set HostName $(scutil --get LocalHostName)
``` as part of my first boot script. I also write the name out to a file in case I need to change it back if a user renames it something non-standard.


The $HostName attribute has always been a PITA for us, as it uses whatever DNS thinks it should be.



Not saying Microsoft is playing a cruel joke on the Mac community, but I really wish DNS could play nice with Macs...a good start would be to enableScavenge Stale Records by default in DNS...



http://technet.microsoft.com/en-us/library/cc959277.aspx



</rant>