Creating a Windows 7 image for deployment to a virtual machine is not as straightforward as you might think. If you simply perform a standard installation, image that to a WIM with ImageX and then attempt to deploy that image, you will be left with a system that requires that the boot manager be recreated.
If you create a VM and insert your Windows 7 media and proceed to click Next through the entire installation wizard you will end up with a system that is actually installed on two partitions and not deployed back from WIM without requiring repair.
One tool that can be used is the Wim2Vhd tool. This is useful if you meet the client requirements and have a way to import the resulting VHD into a new VM. It performs the required repair for you.
However, I would like to avoid the situation of needing to perform the BCDBoot repair all together.
Say that you want to use ImageX (from the Windows Automated Installation Kit ) to image the Windows 7 installation to a WIM and then deploy that Windows 7 image to other virtual systems. I do not want to repair each and every time – I want to build the reference system in a way that this is not required.
The key is to prevent the default Windows 7 installation behavior of creating a System Reserved partition (which contains the necessary boot loader files) and a separate partition where the OS is installed (where there are no boot loader files).
Method One – pre-partition the virtual disk:
This is the most direct approach; in the end nothing looks unusual.
1. Create the VM from a template
2. Boot to WinPE (or mount the disk to another (helper) VM)
(An alternative to this is to boot using the installation media. At the “Install Windows” screen (the first screen of the installer) type Shift+F10 to open a command prompt)
3. Run diskpart
a. List disk
b. Select the disk
c. Create a primary partition (you must use the entire volume)
d. Make the partition Active
e. Format the volume
4. Power off the VM ( or detach the virtual disk from the helper vm)
5. Attach the Windows 7 installation ISO
6. Boot to the ISO
7. Begin the installation wizard
8. Select a “Custom” installation
9. At the “Where do you want to install Windows” screen accept the volume that was previously formatted
10. Complete the wizard
11. Apply all installations and patches to your VM
12. Prepare your VM with sysprep
13. Boot the VM to WinPE
14. Create your VM image using ImageX.
Method Two – confuse the installation wizard:
I could not think of a better title for this, because really what you are doing is messing with the options allowed in the installation wizard until you get the behavior you want.
1. Create the VM from a template
2. Attach the Windows 7 installation ISO
3. Boot to the ISO
4. Begin the installation wizard
5. Select a “Custom” installation
6. At the “Where do you want to install Windows” screen
a. Select the virtual disk
b. Select “Drive options (advanced)”
c. Select “New”
d. The default should be the entire volume – Select “Apply”
e. Acknowledge the warning
f. Select and Delete Partition 2
g. Acknowledge the warning
h. Select and Extend the System Reserved partition
i. The default should be the entire volume – Select “Apply”
j. Acknowledge the warning
k. Select Next
7. Complete the wizard
8. Apply all installations and patches to your VM
9. Prepare your VM with sysprep
10. Boot the VM to WinPE
11. Create your VM image using ImageX.
The primary difference between the results of the two methods is:
- Method Two results in a deployed image where the C: volume name is “System Reserved”