Which Prestart command will I get?
For those of you doing OS deployments with System Center Configuration Manager 2012 (I bet the same info below applies to the 2007 version but haven't tested it) you may have gotten into prestart commands to run a custom script or perhaps an HTA to better control and customize the deployment process for your environment. I have a customer doing this and in the process they noted that there are actually two different places you can set the prestart command (also know as a pre-execution hook). Depending on how your deploy your OS you may only have one place that will work for you, but what happens if you set different scripts in both locations?
Setting in WinPE
The first place you can set is on the boot WIM itself. You specify a script source location and a command line.
This ends up making it into the TSCONFIG.ini that is in the root of the WinPE drive when it boots up and looking something like (command line is different because of the timing of my screen shots, but you get the point I hope):
[CustomHook]
CommandLine=dumpvar.vbs
Source=SMS10000
When the task sequence process runs it finds this TSCONFIG.ini and launches the script as desired
Setting during Boot Media Creation
The other option is to add the hook during creation of your boot media.
In this case, the package gets pulled from the DP and put into the boot media with the WinPE along with a modification of the TS variables so that on startup and reading the variables the value is seen and the hook will be executed.
So what happens if you set both? Take your guess before reading on and see how smart you are. I’ll give you a hint… I originally thought both scripts would execute..., and I was wrong.
The process SCCM goes through is to check the variables to see if the media had set them to have a hook. If so… that is what executes and the fact that the TSCONFIG.ini has a value is ignored. Only when the variable is unpopulated will the ini be checked and that hook will be executed.
8/6 update - Fixed an image display problem. Screen shots and logs may not line up correctly on script names and such. Sorry.
Comments
- Anonymous
January 01, 2003
thanks - Anonymous
October 14, 2014
Thanks - Anonymous
December 10, 2014
great post