Capture and Apply Windows, System, and Recovery Partitions
Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2
By using Windows image (.wim) files to deploy Windows, you can do the following:
Change the drive partition configuration.
Change the Windows image itself easily with tools such as DISM.
Create scripts that modify the partition sizes based on the drive installed on a particular PC.
Reduce the management of individual partitions by using Windows tools to create and configure new partitions.
The procedure below walks through creating an image of the Windows partition on a drive, and using the files in that image to set up the rest of the partitions on the drive.
The following diagram illustrates this process:
For full code samples that summarize these steps, see Samples: Applying Windows, System, and Recovery Partitions by using a Deployment Script.
Prepare the reference PC for image capture and deployment
- Before you can deploy a Windows image to another PC, you must first generalize the image. For more information, see Sysprep (Generalize) a Windows installation.
How to capture only the Windows partition, and configure other partitions during deployment
Boot the PC using Windows PE.
Capture the Windows partition. For example:
Dism /Capture-Image /ImageFile:"D:\fabrikam.wim" /CaptureDir:C:\ /Name:Fabrikam
Where D: is a USB flash drive or other file storage location.
On the destination PC, use a DiskPart script to configure and format your hard drive partitions. For more information, see Configure UEFI/GPT-Based Hard Drive Partitions or Configure BIOS/MBR-Based Hard Drive Partitions.
If you apply an image to a volume that has an existing Windows installation, files from the previous installation may not be deleted. Format the volume by using a tool such as DiskPart before you apply the new image. For example:
diskpart /s CreatePartitions.txt
Copy the image to the recovery image partition:
copy D:\fabrikam.wim R:\install.wim
where R:\ is the recovery image partition.
Apply the image to the Windows partition:
dism /Apply-Image /ImageFile:R:\install.wim /Index:1 /ApplyDir:C:\
where C: is the Windows partition.
Copy the Windows Recovery Environment (RE) tools into the appropriate partition.
For Unified Extensible Firmware Interface (UEFI)-based PCs, copy these tools into a separate Windows RE tools partition:
md T:\Recovery\WindowsRE copy C:\Windows\System32\Recovery\winre.wim T:\Recovery\WindowsRE\winre.wim
On BIOS-based PCs, copy these tools into the System partition:
md S:\Recovery\WindowsRE copy C:\Windows\System32\Recovery\winre.wim S:\Recovery\WindowsRE\winre.wim
Configure the system partition by using the BCDBoot tool. This tool copies and configures system partition files by using files from the Windows partition. For example:
Register the location of the recovery image by using REAgentC. For example:
C:\Windows\System32\reagentc /setosimage /path R: /target C:\Windows /index 1
Register the location of the WindowsRE tools by using REAgentC.
For UEFI-based systems, copy the image to the use the image location as the Windows RE tools partition. For example:
C:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target C:\Windows
On BIOS-based systems, set the image location as the System partition. For example:
C:\Windows\System32\reagentc /setreimage /path S:\Recovery\WindowsRE /target C:\Windows
Other methods of applying images
Capture and apply each individual partition. This method enables you to manage customized system and recovery partitions. Note, for UEFI-based PCs, do not capture and apply the EFI system partition or the MSR partition – these are managed by the PC. Use the BCDBoot command to configure the system partition:
Capture and apply the entire drive. You can use third-party software to capture and apply the entire drive. This method works well for multicast deployment.