Hostname change
-
Greetings, I am using Fog to deploy images, After deploying multicast image I do not want the hostname to be changed as this will be set as part of the mini setup process following the reboot of the pc once the image is deployed as the image was taken after having been sysprepped, however despite having ensured that the "HOSTNAME Changer Enabled? has NOT been selected I am still finding that after the image gets deployed it it still displays “hostname change --done” I would like it to be skipped in the sameway as when you do a quick image i have found shows " hostbname change – Skipped.
Also is it possible to provide some information on how the hostname change actually works, does it only work with the fog client installed on the imaged pc’s
Many Thanks for you help
Denis -
My understanding of this is that it changes the name by editing the registry key’s directly within the fog system. This is nice as it doesn’t require the system to contain the FOG Service client. However, I think the pertinent part here is that it’s a part of the FOG script.
From the fog script:
if [ “$capone” != “1” ]; thenchangeHostname
Then from /usr/share/fog/lib/funcs.sh
changeHostname()
{
echo -n " * Changing hostname…“;
if [ -n “$hostname” ]
then
mkdir /ntfs &>/dev/null
regfile=”“;
key1=”“;
key2=”";
if [ “$osid” = “5” ]
then
ntfs-3g -o force,rw $win7sys /ntfs
regfile=$REG_LOCAL_MACHINE_7
key1=$REG_HOSTNAME_KEY1_7
key2=$REG_HOSTNAME_KEY2_7
elif [ “$osid” = “1” ]
then
ntfs-3g -o force,rw $part /ntfs
regfile=$REG_LOCAL_MACHINE_XP
key1=$REG_HOSTNAME_KEY1_XP
key2=$REG_HOSTNAME_KEY2_XP
fi
reged -e “$regfile” &>/dev/null <<EOFREG
ed $key1
$hostname
ed $key2
$hostname
q
y
EOFREG
umount /ntfs
echo “Done”;
else
echo “Skipped”;
fi
}The reason you’re not seeing it get changed in quick image is that runs a different script called fog.quickimage. On reboot the task doesn’t set the $hostname variable which is to be skipped. The only way, I could think, to get this is to comment out the changeHostname field in /bin/fog of the init.gz on line 606.
[COLOR=#000000]if [ “$capone” != “1” ]; thenchangeHostname[/COLOR]
[COLOR=#000000]if [ “$capone” != “1” ]; then
changeHostname[/COLOR]
[COLOR=#000000] [/COLOR]
-
I don’t use the registry key way (removed it from my init.gz) i get the fog script to edit the sysprep file main reason get it to do it while it’s changing the sysprep file to join the domain or specified workgroup - so it’s all done by sysprep - only use the FOG Client for snapins.
-
Thanks very much for the comments so far received, just to confirm I am not using the fog clients, I am only using for to deploy images and do not want fog to interfere\change anything on the image that is deployed.
I tried to # out the entry in the init.gz file , but after making the change found the init.gz image would not load when testing a deployment.
when setting up a multicast job , files for each pc is writen to the /tfptboot/pxelinux.cfg/ when looking at each of these files that is an entry for hostname, if I delete the hostname bit the deplyed image will skipp the change hostname bit.
What determines what details get written to these files.Thanks again
Denis -
When you’re mounting the init.gz, follow these steps:
gunzip init.gz
mkdir tmp
mount -o loop init tmp
vi tmp/bin/fog
:606
i#ESC
:wq!
umount tmp
gzip -9 init
rm -rf tmpYou should be good to go.
-
Hi Tom, Followed steps as mentioned, seems to be working well,
Thanks very much for you help, much appreciated,
Regards
Denis -
No problem.
-
In the FOG web management, you can update the value under Other Information -> Fog Settings -> FOG_CHANGE_HOSTNAME_EARLY to 0 and the imaging script will not try to update the username by editing a registry key before windows loads.
If you do not install the FOG service, you’re hosts will not rename after they load windows. You can also disable the hostnamechanger option in the FOG Service install, per host record, and for your FOG server completely.