MDT 2010 New Feature #17: Customizable boot image process
I mentioned before that the boot image creation process used by the Deployment Workbench is significantly enhanced in MDT 2010 Beta 2, but didn’t really talk too much about how the process works behind the scenes. Now, this is template-based, with XML files that specify exactly what should be included in each boot image that we generate:
- LiteTouchPE.xml. This defines all the components, files, and settings that should be included in any Lite Touch boot images generated by Deployment Workbench.
- Generic.xml. This defines all the components, files, and settings that should be included in any “generic” boot images generated by Deployment Workbench.
When you perform the “Update Deployment Share” process, the Deployment Workbench will take these XML files (located in C:\Program Files\Microsoft Deployment Toolkit\Templates), add some additional items to them (e.g. settings you specified on the deployment share properties such as optional components to add, settings like RAMdisk size, etc.), and then use that to build the new boot image. (As mentioned in the previous article, the process is optimized to only do the minimum amount of work – it does this by comparing the new XML file against the one generated the last time the boot image was generated. It then figures out what needs to be done based on the difference between the two.)
So what if you want to add your own files into our boot images? Just modify the template to tell us where to get them and where to put them in the image and the “Update Deployment Share” process will take care of it.
That’s fine for simple additions like adding files, but what if you want to do something more substantial? That’s where exit scripts come in. (I call this the “Johan feature”.) You’ll notice that the existing templates specify a sample exit:
<!-- Exits -->
When the “Update Deployment Share” process runs, this exit script will be called multiple times for each phase of the process, allowing you to make customizations to the process. Variables will be passed along so that you know where everything is located, what is currently going on, etc. The phases:
- “WIM”. The exit script is called after the WIM has been mounted and customized, just before the changes are going to be committed. At this point, you can manipulate the WIM contents (copy files, create folders, mount the registry, add registry keys – anything you would like).
- “ISO”. The exit script is called just before the boot ISO is being created. This lets you add files to the boot ISO without sticking them into the RAMdisk.
- “POSTISO”. The exit script is called one more time after the ISO file has been created and before that ISO has been copied back to the deployment share. At this point, you might choose to copy it to a public share, automatically burn it to a CD, etc.
In each of the phases, various environment variables are defined:
- INSTALLDIR. This points to the MDT 2010 installation directory, e.g. “C:\Program Files\Microsoft Deployment Toolkit”.
- DEPLOYROOT. This points to the deployment share currently being updated, e.g. “\\SERVER\DeploymentShare$”.
- PLATFORM. This will be set to either “x86” or “x64”, depending on which boot image is being generated.
- ARCHITECTURE. This will be set to either “x86” or “amd64”, depending on which boot image is being generated. (Sometime its useful to have the “x64” value and other times “amd64” is more useful, so we report both.)
- TEMPLATE. This indicates whether a Lite Touch boot image is being generated (LiteTouchPE.xml) or a generic boot image is being generated (Generic.xml).
- CONTENT. This tells you where to find the content for this phase:
- For the WIM phase, it points to the mount location for the WIM (a temporary folder where you can manipulate the contents of the mounted WIM).
- For the ISO phase, it points to the folder that will be used to create the ISO (again a temporary folder).
- For the POSTISO phase, it will point to the created ISO file (located on the local machine, before it is copied back to the deployment share).
- STAGE. WIM, ISO, or POSTISO, as described above.
The “C:\Program Files\Microsoft Deployment Toolkit\Samples” directory does contain the UpdateExit.vbs script described above, which demonstrates all the variables I described.
There is one bug in MDT 2010 Beta 2 that I have to point out though: the “STAGE” variable is always set to “WIM”, so it’s kind of hard to figure out which phase you are currently in. That’s been fixed for the released version of MDT 2010.