The concept of pre-staging an operating system for deployment with OSD is well understood and effective. There is plenty of documentation detailing configuring pre-staging for legacy BIOS based systems. But what about pre-staging with UEFI based systems? I and a couple of colleagues struggled through this recently. The process if similar in concept to BIOS based systems but different in implementation.
Before I get to the details let me start from the beginning. Pre-staging in OSD is the process of pre-loading Windows PE and the image you want to deploy onto the hard disk of a system. A pre-stage scenario is often thought to be applicable only to PC OEM’s but is also applicable in other scenarios, such as an on premise build lab. In ConfigMgr 2012 you also have the ability to pre-stage any content referenced by the task sequence, such as packages or applications, which further conserves network resources and enhances the efficiency of a pre-stage scenario. Once loaded those systems are shut down and shipped to wherever they will reside. When powered up the system will boot back into Windows PE and apply the operating system that is already in place, along with any configured references, without the need to again download the content from the network.
The process of pre-staging systems requires a few configurations.
1. Import an Operating System WIM you wish to deploy
For my lab scenario I simply used the install.wim from the Windows 8 media. In earlier versions of ConfigMgr using the media based WIM directly would not work but in ConfigMgr 2012 this works fine.
2. Create a task sequence to deploy the WIM imported in step 1.
For my lab I simply use a basic task sequence without the format/partition step. Note: The drives on the system will already be formatted and information staged here as part of the pre-stage process so you don’t want to again partition and format and wipe that information away.
3. Create the Pre-staged media.
The Create Task Sequence Media option will allow you to launch the Pre-Stage media wizard, as shown. There are a number of options available on the wizard, including the ability to choose a task sequence that will be deployed as part of the pre-stage process. You also have the ability to choose drivers, applications and other content you wish to include as part of the pre-stage media.
In my lab the resulting media is called prestage.wim. As you read some of the documentation for BIOS based pre-stage the instructions will be to import the WIM created for pre-stage into the console so it can be referenced by the Apply Data Image task sequence option. For pre-staging with UEFI systems you should NOT use the Apply Data Image task sequence option and, instead, simply use ImageX or DISM. For that reason there really is no need to import the pre-stage WIM into the console and, as you will see, I simply reference it on a network location.
4. Create a task sequence to manage the pre-staging process.
The task sequence for staging the pre-stage WIM is where the magic happens so let’s slow down and work through the steps. The task sequence looks pretty basic, and it is, but there is a lot that happens here.
Connect C: to CAS
The first step of the task sequence is to map a network drive to a share in my environment. This share contains both the pre-stage WIM file and two scripts that will be used during the pre-stage process. In my case I chose the CAS to host these files.
Copy UEFI files
This step simply copies the two scripts that will be used in later steps into the root of the X:\ drive. The X:\ drive is the RAM disk created by PE when it starts up.
Partition Disks – UEFI
This step is used to partition and format the disk as needed for a UEFI system. The step leverages a diskpart script for controlling the action. I did NOT use the native Partition and Format step because I need a bit more control over the process than what is afforded in that step.
select disk 0 clean convert GPT create partition EFI size=200 format quick fs=fat32 label=EFI assign letter=S
create partition MSR size=128
create partition primary format quick fs=ntfs label=Windows assign letter=C list vol
This step applies the pre-stage WIM file to the C:\ drive. The WIM file is pulled from a network location that I mapped to earlier. Normally I would use the Apply Data Image step but there seem to be some things done in that step that don’t work well with UEFI so instead I use DISM directly.
This step make use of my second script to make sure files are positioned as needed ahead of shutting down the system and preparing for the reboot. The script references drive letters based on what was configured in the diskpart step earlier. Also, the script references the D: drive because this is what is normally associated with the boot media. Remember, X:\ is the Windows PE RAM disk but D:\ is the drive associated with the physical USB or CD based boot media. Depending on your specific system configuration you may need to alter the mapping.
The shutdown step forces a shutdown of the system. It may not seem like it but this is a critical step. If you fail to use this step and allow the task sequence to exit normally then the _SMSTaskSequence folder will be removed and the process will fail.
And that’s it – when you turn the system back on after a shutdown it should boot back into Windows PE to allow you to continue the imaging process but now most, if not all, of the content will be pre-loaded onto the hard disk. Overall, the process here is not too difficult but awfully frustrating if you had to figure this out on your own (trust me!).
A couple of closing observations that might help as well
- The UEFI boot process can take some time, particularly if you have PXE boot configured. It may appear the process is failing but if you wait long enough it should kick in. - UEFI is architecture specific so if deploying a 64 bit OS you must use 64 bit boot media. - In this example it is assumed that the source media being used is either CD or USB. This process was not tested on PXE but should work there as well, albeit a few tweaks may be needed.