In my WinPE-related posts I have written a few how-to posts on building a Windows PE boot disk, capturing a Windows 7 image and adding drivers to a .wim image offline. This leads me nicely onto this post about applying Windows 7 .WIM images using the ImageX tool.
What you will need
- Windows PE boot disk with ImageX
- .WIM Windows 7 image file
- Target computer to apply the Windows 7 image
1) Boot your target computer with the Windows PE boot disk
You will need a Windows PE boot disk with access to the ImageX tool. Check out my previous post on how to create Windows PE USB boot disk.
2) Partition the Hard Disk
The first step here is to create two partition on the target disk –one for the System partition and the other for the actual Windows installation. The “System” partition is reserved for the BCD store (for booting), the Windows Recovery Environment and BitLocker for some Windows 7 editions.
OK, so proceed with these instructions on the Windows PE command prompt, adapting it to your needs as necessary (you may want another partition for your data, for example). Here, though we’re only creating the default System and Windows partitions:
diskpart select disk 0 clean create partition primary size=300 format quick fs=ntfs label="System" assign letter=S active create partition primary format quick fs=ntfs label="Windows" assign letter=W exit
We are assigning the Windows partition the drive letter W only to avoid potential drive letter conflicts. You will notice that the Windows partition will revert to drive C:\ when you launch Windows. Also you will not see the System partition as this is typically hidden from view.
3) Prepare the source where the .WIM image file is located
3.1) Image is located on a local drive
If your .WIM image is stored on a local drive such as a USB hard disk then you need to identify the drive letter of the drive. Use diskpart as below to work this out
diskpart list volume
This will present a table of all drives attached to your computer and the drive letter associated with it
3.2) image is located on a network share
If on the other hand your .WIM image is on a network share then use the net use command to map the share to a drive letter as below
net use N: \\ServerName\ShareName * /user:username
In the above example the drive letter we’re mapping to our share is N. Use your own network share and a user account and enter the password when prompted for the user account.
4) Apply the Image
Here’s the basic format of the imagex capture command:
Imagex /apply wim-image index destination-drive
And here’s an example where our .WIM image is located in D:\Images\ref-win7-image.wim and the destination drive is W:\
imagex /apply D:\Images\ref-win7-image.wim 1 W:\
You should see the progress of the image being applied in percentages, followed by a
“Successfully applied image” message once the image has been applied.
5) Configure BCD boot
After the image has finished being applied to the destination drive we now use bcdboot.exe to copy the default boot files from our Windows partition to the ‘System’ partition.
The example below copies the boot files to the S:\ drive (which is the drive letter we associated with the System partition in Step 2)
W:\windows\system32\bcdboot.exe w:\windows /s S:\
Once you run the command you should see a confirmation message such as “Boot files successfully created”.
This final step completes the whole process of using ImageX to apply a Windows 7 image to a destination drive.
- Boot computer with Windows PE, and use diskpart to create a System partition and a Windows partition
- Prepare the source directory where the .WIM image is located – use diskpart to work out the drive letter of a local disk where the image is stored or if the image is stored on a network share use the net use command to map a network share to a drive letter
- Use the imagex /apply command to apply the.WIM image form the source directory to the Windows partition created earlier
- And finally use bcdboot.exe to copy boot files to the System partition
Follow Me, Myself and IT on Twitter:Follow @emeneye