Fog Hostname problem after w10 SYSPREP
-
Hello everyone,
Our environment :
-fog server 1.5.9 on deb12
-W10/W11 clients without fog client serviceWith this AmaZing Fog, When i deploy image W10 without sysprep, the hostname is the one that i have written in Fog GUI, and all is fine.
When i deploy image W10 with sysprep, the hostname is random and different of my Fogdatabase.
In the unattend file i got <ComputerName></ComputerName> and with or without value it changes nothing, it’s not the fog hostname from GUI.
In fog server, i saw variable called $hostname, is it possible to implemant this variable in the unattend file ?
or another easy way is possible ?Need Help please. Thx
-
@jeje3346 I have seen this issue when sysprep domains the computer through the unattend file. Once the computer is domained, FOG is not able to change the computer name. If this is the case, I would recommend you domain the computer through the active directory options in FOG or through a snapin instead of the unattend file.
I would also recommend you upgrade your FOG install to the latest stable release 1.5.10.1629 since there have been a lot of improvements done since version 1.5.9.
-
@rodluz
Thx you for tour answer. Well, at first and to this stape, we don t want any options for joining domain. That s why our unattend file is voluntary light.
I will try a fog client installation on my golden image before sysprep then New capture and deploy to see if it changes something or not with the hostname.
Moreover I will try to migrate on 1.5.10 like you suggest.
I will tell you the results. -
@jeje3346 Oh yes the other thing I forgot in my previous reply is that you need to have the FOG client installed on the computer so that the name change can happen.
If you are wanting to install the FOG client on your golden image, make sure that you disable the FOGService in the windows services. You can use this link for reference of how to do this correctly with sysprep. https://wiki.fogproject.org/wiki/index.php/FOG_Client#FOG_Client_with_Sysprep
-
@rodluz
Hello rodluz,
Well i follow what you suggest and it works with Fog client into the machine the Setup complete and auto reboot.I would have prefered a solution without the Fog client on machine but it seems impossible with sysprep stape.
Thx a lot for your help!!
-
I found this post
https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script/15moderator @george1421 put an important information about possibility to update unattend file. So it would be possible to use Fog variable into the file.
If it works like he says so it means that i don t need Fog client install on my golden image and the Setup complete cmd.If i understand, first in put in a post download script (/images/postdownloadscripts/myfogscript.sh)
This :
Unattend.xml path (note the case specifics in the file name and path)
unattendfile=“/ntfs/Windows/Panther/unattend.xml”;
And this :
sed -i -e “s#<ComputerName>([^<][^<]*)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi” $unatendfile
So it means that it could may be possible to change hostname without fog client on machine right?
-
@jeje3346 Technically speaking, anything is possible.
These postdownload scripts are customizable to your hearts content, so yes it’s possible, technically, but as far as getting support for your own scripts, we’ll try, but it’s still all best case.
The FOG Client will do so in a well standardized method but if you don’t want to use that, that’s perfectly fine as well.
We will still attempt to assist as required.
Thank you,
-
@Tom-Elliott
i think the postdownload possibility is just amazing cause you can personalize like you want.in /images/postdownloadscripts/ :
fog.postdownload (default file)
fog.custominstall- in fog.postdownload (i call the created file)
. ${postdownpath}/fog.custominstall
- in fog.custominstall (unattend declaration & sed command)
unattendfile=“/ntfs/Windows/Panther/unattend.xml”;
sed -i -e “s#<ComputerName>([^<][^<]*)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi” $unatendfile
Should be right ?
-
@jeje3346 it looks correct, yes.
You could test it by creating a simple example of the file and running the sed statement itself. Ultimately, though, it should work properly.
-
script is working but something is wrong
it seems that fog cannot find or access to the unattend file (autounattend.xml)
i have read in a @george1421 post a special bloc like :
####################windows 10/11
osdiskpart=“/dev/sda2”;
mkdir /ntfs 2>/dev/null
mount.ntfs-3g “${osdiskpart}” /ntfs 2>/tmp/mntfail
mntRet=“$?”;
if [ ! “$mntRet” = “0” ]; then
echo “Failed to mount C:”;
cat /tmp/mntfail;
sleep 12;
exit 1;
fi
####################Should i put this in my fog.postdownload juste before my sed command or am wrong and another way exists ?
-
You would have a postdownload script of something like:
osdiskpart=“/dev/sda2”; mkdir /ntfs 2>/dev/null mount.ntfs-3g “${osdiskpart}” /ntfs 2>/tmp/mntfail mntRet=“$?”; if [ ! “$mntRet” = “0” ]; then echo “Failed to mount C:”; cat /tmp/mntfail; sleep 12; exit 1; fi unattendfile=“/ntfs/Windows/Panther/unattend.xml”; sed -i -e “s#<ComputerName>([^<][^<]*)</ComputerName>#<ComputerName>$hostname</ComputerName>#gi” $unattendfile
Of course this assumes that /dev/sda2 is the windows main partition.
-
@Tom-Elliott
The last problem was tha windows main partition ! Now it works perfectly ! Thx for your precious help.Solved