Post download install script
-
hi, I have a question, in the fog server I can’t understand where and the setting of the post install deploy image scripts.
I read that there is a section in the fog settings, but I can’t find it,
I also tried to enable fog_post enable 1 in the fog configuration file but nothing. in practice the script must be created in the images/postdownloadinstall folder but the path must be set in the fog server right?
who can help me? -
@alexamore90 The post install scripts are automatic (well kind of). As part of the imaging process FOG automatically calls the script in /images/postinstall directory on the fog server. The current script in there does nothing but runs and exits. The idea of post install scirpts are for you to write bash scripts to do things to the target computer just after the image is deployed to the target computer and just before the fog releases the target computer with a reboot.
I have some posts install script tutorials here that discuss what is needed. https://forums.fogproject.org/topic/8889/fog-post-install-script-for-win-driver-injection
You have to remember that the bash script is stored on the fog server but executed by the target computer during imaging. Its a linux script so it can’t interact directly with windows on the target computer. For example you can call windows regedit and update registry entries from a post install script. But there is linu commands that can do similar actions.
-
ok, my intention is to create a script in the post-installation folder that allows me to open the start ms-settings:activation command as administrator in the preliminary phase of windows 10, after having distributed the image. can you help me george? A thousand thanks
-
@alexamore90 That sounds like a job for the unattend.xml file as part of a generalized hardware agnostic build of windows, not something FOG in a post-install script would be able to accomplish.
-
but I read that just write in the post install file in the images folder
start ms-settings:activation, but it doesn’t work once deployed -
@alexamore90 said in Post download install script:
my intention is to create a script in the post-installation folder that allows me to open the start ms-settings:activation command as administrator
This is the point I warned you about, you can not step into the windows world from a post install script. The only thing you can do is leave behind bread crumbs that windows will find during oobe.
So for your activation stuff. I typically use a volume license key for activation and have the unattend.xml file activate windows.
You can also (assuming you sysprep’d your golden image) use the setupcomplete.cmd batch file (that you create) to activate windows. This batch file is executed after OOBE/WinSetup and just before the login prompt is displayed. You can put the commands in there to activate windows.
Lastly you can use a fog snapin to execute the activation commands as the SYSTEM user.
-
@george1421 ok, but I can use a snapin with a batch file that opens start ms-settings:activation after deploy, but there are no hosts, the PCs are not registered they are always different.
can the snapin be associated with all the storage and therefore with the images without accounting for the hosts? -
@alexamore90 said in Post download install script:
PCs are not registered they are always different
OK so snapins are not possible if the target computers are not registered.
So you will then use the setupcomplete.cmd batch file https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup?view=windows-11
The very fist post here shows how to activate windows using a batch file: https://gist.github.com/Dhanvesh/abcc26792f08755827bc2cd64c50ac3c There are several different activation methods here so pick the one that fits your requirements.
-
@george1421 ah ok, could you tell me the procedure to do this?, how does it work before capturing the image?
-
@george1421 Will the setupcomplete.cmd script work even in the preliminary stage without configuring windows 10?
-
@alexamore90 said in Post download install script:
Will the setupcomplete.cmd script work even in the preliminary stage without configuring windows 10?
I think you miss something or I explain it bad.
The workflow for image deployment is like this
- Build golden image of Windows
- Sysprep image using windows sysprep tool and have sysprep power off windows computer.
- PXE boot and capture with FOG
- Deploy with FOG, before FOG reboots computer it will use post install script to add windows drivers or make other deploy time changes to windows configuration files. (you do not use this part because it can not change windows internals)
- FOG reboots computer
- Windows OOBE/WinSetup runs to configure windows on target computer (at this point FOG is done, no actions with target computer)
- Windows OOBE/WinSetup finishes by running the setupcomplete.cmd batch file. This file makes any final adjustments to windows needed by the windows image designer. You can add user accounts here, or activate windows or anything you can do via windows command line.
- Windows displays the first login prompt.
The execution of the setupcomplete.cmd batch file is automatic and controlled by WinSetup. The batch file must exist in a specific location on the c drive and it will be run.
-
@george1421 so if I understood correctly, I just create the setupcomplete.cmd file and write inside it start ms-settings:activation inside C:\ in audit mode and then when I go to deploy the image when starting windows 10 the right window opens ?
-
@alexamore90 said in Post download install script:
it start ms-settings:activation
I don’t know that command. I have not used it before.
I;ve used the command line scripts
cscript //nologo c:\windows\system32\slmgr.vbs /ipk <activation_key> cscript //nologo c:\windows\system32\slmgr.vbs /ato
The setupcomplete.cmd will only run if you use sysprep. Do you sysprep your images before you capture with FOG?