If you allow the Windows 7 setup CD to create your primary partition, it will actually create two partitions, a hidden 100mb system reserved partition used for bootmgr and bitlocker, and the remaining space in a second partition.
Brian Jackson's Diskpart script does not take into account the hidden 100mb partition and if it's not restored, the machine will not boot, showing a cannot find bootmgr error. BCDEdit /set <...> always produces the following error message:
The boot configuration data store could not be opened.
The system cannot find the file specified.
Thus, the following is how to properly image/recreate BOTH partitions.
When you load up WINPE, drive C: is assigned to the 100mb system reserved partition while drive D: is assigned to the windows partition. In order to correctly capture an image of your machine, you need to use Imagex (or GImagex) to make a WIM of BOTH the C drive and the D drive. On the machine you wish to deploy this image, with the WINPE disc loaded, you need to recreate both partitions by entering the following in the WINPE command prompt:
*Select disk 0
Create partition primary size=100
Select partition 1
Format fs=ntfs quick
Create partition primary
Select partition 2
Format fs=ntfs quick
*It's very possible that disk 0 is not the correct drive. You should therefore type "list disk" prior to the "select disk" step and change the 0 to the number corresponding to your physical hard drive. Occasionally, Disk 0 referenced my USB flash drive while Disk 1 was my physical hard drive.
Reboot the machine and reload the WINPE disc so that both partitions are reassigned the correct C and D drive letters. Load up GImagex deploy the system reserved image back to the C drive and the windows image back to the D drive.
You can avoid this process altogether by using a 3rd party program (such as Brian Jackson's DISKPART script on the WINPE cd) to partition the drive before installing windows 7 on the machine you're imaging. The hidden 100mb partition will not be created and you will not have to image two partitions. Another workaround is to use Acronis True Image or Norton Ghost loaded from a boot disk. Those programs can make an image of your entire sysprepped drive and all of it's partitions like Imagex does, but they are much easier to use and far more user friendly. If you have no intentions of using bitlocker, I strongly suggest doing the above so that the 100mb hidden partition is not created, as it appears there may be other issues with sysprep when you have any additional partitions on the drive. (see
"Windows could not finish configuring the system. To attempt to resume configuration restart computer")
“Windows could not finish configuring the system. To attempt to resume configuration restart computer”