Posted on 08-16-2012 09:38 AM
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?
Solved! Go to Solution.
Posted on 08-17-2012 07:31 AM
something like this perhaps...
# set the computer name
setName=networksetup -getcomputername
scutil --set ComputerName ${setName}
scutil --set LocalHostName ${setName}
scutil --set HostName ${setName}
Posted on 08-17-2012 07:39 AM
#!/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
Posted on 08-16-2012 09:51 AM
Can you please state what version of the OS you're trying to image and what version of the JSS you're on?
Posted on 08-16-2012 10:06 AM
Absolutely - sorry for the omission.
Posted on 08-16-2012 03:59 PM
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.
Posted on 08-16-2012 06:04 PM
yeah, I do the same as alex. scutil in a script for the win on this one.
Posted on 08-17-2012 06:56 AM
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 ?
Posted on 08-17-2012 07:14 AM
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.
Posted on 08-17-2012 07:31 AM
something like this perhaps...
# set the computer name
setName=networksetup -getcomputername
scutil --set ComputerName ${setName}
scutil --set LocalHostName ${setName}
scutil --set HostName ${setName}
Posted on 08-17-2012 07:39 AM
#!/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
Posted on 08-17-2012 07:47 AM
So does
sudo jamf -setComputerName <some name or action>
Not work?
Posted on 08-17-2012 08:31 AM
Not if the JSS's record has already been hosed up.
Posted on 08-17-2012 03:52 PM
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.
Posted on 08-17-2012 04:42 PM
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>