FOG Golden Image, Sysprep and unattend post install
-
Hello Everyone
Hello everyone,I am new to the forum, I thank in advance those who will be interested in the following post
I have a question about the post-installation method, specifically about the unattend.xml file.- Step 1 OK : I created an image, which we can call “Golden Image” with an unattend.xml file that I then captured via FOG.
My unattend file does not contain the command to run a post instlal script like Powershell or SetupComplete.cmd***
- Step 2 OK : I then used these 2 guidlines to copy the drivers according to the computer model:
This method allows me to :
- Update the unattend file (unattend.xml) here: C:\Windows\System32\Sysprep
- Drop the drivers folder here: C:\Drivers\
- Install powershell scripts here: C:\FOG
Current folder structure :
C:\FOG
C:\FOG\Master_Script
C:\FOG\Scripts
C:\FOG\Logs
These scripts contains code to install : Drivers, FOG client,specific configurations
-
I’d like to know if the unattend file I’m updating via the post-installation method is updated before the OS starting the image that has already been sysprep. So that I can update it dynamically.
This would also allow me to run my script located at this level: C:\FOG\Master_Script … because I didn’t indicate this in the nitial unattend.xml file. -
is it possible to rename automatically (with script?) the machine after post-sysprep initialization, reusing the computer name from Full Inventory ?
Thank you for your replies
-
@HorizonG I’m going to touch on a few things as you mentioned them in your OP.
If you are using the enterprise os for deployment with a vl key, the setupcomplete.cmd file should be called by winsetup. This is a feature of windows not fog. You could setup your unattend.xml file to auto login X times and then in the first run section call external batch files and powershell scripts.
Make sure you place the unattend.xml file in the proper location in the panther path. You will have much less issues if you place it there. Then when you call sysprep define the path to the unattend.xml file.
Your folder structure is OK. When I was doing deployments I put all of the files needed for post deployment (minus the unattend.xml file) in c:\windows\scripts directory.
To your specific questions.
- Yes it can be updated dynamically. I have example snippets of a post deployment script that shows how. https://forums.fogproject.org/post/69726 In my case I didn’t use the fog client at all and set the computer name, target OU, timezone, location, and keyboard using the IP address of the target system and knowing what IP range each site had. Look at this thread, the top post has links to some of the other ones where I go into a bit more details on the post deployment scripts. https://forums.fogproject.org/topic/8889/fog-post-install-script-for-win-driver-injection Its much easier to edit the unattend.xml script using sed for string locating and replalce. So when I setup like the computer name I would leave the default to something like
<computername>*</computername>
and then search for that string and replace it with<computername>usnycap002</computername>
to define the computer name in the unattend.xml - I kind of answered that in 1. With the postinstall script if you call the hostinfo script you can get access to most of the fog ui variables that you can include in your post deployment script. Again in this post it shows you how to replace the computer name using the fog run time variable $hostname https://forums.fogproject.org/post/69726
- Yes it can be updated dynamically. I have example snippets of a post deployment script that shows how. https://forums.fogproject.org/post/69726 In my case I didn’t use the fog client at all and set the computer name, target OU, timezone, location, and keyboard using the IP address of the target system and knowing what IP range each site had. Look at this thread, the top post has links to some of the other ones where I go into a bit more details on the post deployment scripts. https://forums.fogproject.org/topic/8889/fog-post-install-script-for-win-driver-injection Its much easier to edit the unattend.xml script using sed for string locating and replalce. So when I setup like the computer name I would leave the default to something like
-
Hello @george1421
Thank you, I’ll try your guide on post install.
Yesterday, I had tried to update my unattend.xml file present before the capture which did not contain any script call, the file was updating well on the postdownload machine, but I did not have the impression that the script was called (Script name: fog.copyunattend)For the moment, it’s here C:\Windows\System32\Sysprep\unattend.xml
but I’d move it to this location as mentioned: C:\Windows\PantherI’d also try renaming the post as explained:
with the command:sed -i “/ComputerName/s/*/$hostname/g” $unattend >/dev/null 2>&1
my post install files are called like this :
. ${postdownpath}fog.copydrivers . ${postdownpath}fog.copyscripts . ${postdownpath}fog.copyunattend . ${postdownpath}fog.setupcmd . ${postdownpath}fog.updateunattend
-
@HorizonG said in FOG Golden Image, Sysprep and unattend post install:
’d also try renaming the post as explained:
with the command: sed -i “/ComputerName/s/*/$hostname/g” $unattend >/dev/null 2>&1The variable $hostname comes from FOG, the variable $unattend must come from your script to define the location of the unattend file on the target hard drive.
Something to know, If you are questioning if each script is being called, place an
echo some text
at the top of each script. This way you can see each script being called.One other tip I use for debugging post install scripts is to run a deployment in debug mode. Schedule a deployment, but before you hit the schedule task button tick the debug checkbox. Now schedule the task. PXE boot the target computer you will be met with several screens of text that you need to clear with the enter key. This will drop you at the fos linux command prompt. Now key in
fog
to start single stepping through the deployment. At the end of the image push you should see the post install scripts executing. If you use thedebugPause;
command at certain locations in your script you can stop the execution and wait to press enter. If you were to hit the ctrl-c key you can exit the deploy process. What this will do is give you the exact environment where your script is running. You can try different commands or fix the post deployment scripts. If you enter the commandfog
again you can restart the deployment process again without rebooting.One last tip is that when you are interacting with the deployment process you are executing on screen 1, if you need command shell access you can press alt-f2 to go screen 2 run some comands and then pop back to screen 1 with alt-f1 to continue your script.
The pather location is the location where microsoft recommends you place the unattend.xml file, because it will look for the file there first. Where you get things confused is if you have an unattend.xml file in both locations because it will aways use the pather location first.