01 - How to image a Windows system using a bootable WinPE USB drive and ImageX - RMPrepUSB

01 - How to image a Windows system using a bootable WinPE USB drive and ImageX

Unique hitstumblr site counter

Note: Imaging systems using ImageX is not recommended for fully configured systems which have special ACLs (e.g. file access rights) or reparse points - you are expected to use ImageX on sysprep'ed images only.

The following are the issues when you use the ImageX.exe tool as a backup mechanism:
  • File extended attributes are lost.
  • The ImageX.exe tool only applies reparse points that are symbolic links or junctions.
  • Sparse files on the system are captured and applied. However, the sparse files are no longer sparse after they have been applied.
  • Object IDs on files are lost in the capture process or in the apply process.

How to image a Microsoft® Windows® system using a bootable WinPE USB drive and ImageX

ImageX allows you to take complete backup of a Microsoft® Windows® volume and save the image to a file. You can then restore any system with it's original image in just a few minutes.



1. Install WAIK and create a Windows PE folder

Using your personal Windows XP/Windows Vista®/Windows 7 PC (not the target system that you wish to image):

1. Download the Windows 7 WAIK ISO file (e.g. KB3AIK_EN.iso 1.7GB). You must agree to the Terms and Conditions.

2. Download and install your ISO mount utility. (VirtualCloneDrive in this example)

3. Double-click the WAIK.iso file. The WAIK Welcome window should launch. If not, double-click StartCD.exe on the new drive letter in Explorer.

4. Install the .Net Framework Setup from the WAIK menu.

5. Install the MSXML 6 SP1 Setup from the WAIK menu.

6. Install the Windows AIK Setup from the WAIK menu.

7. Exit from the WAIK menu.

8. Click on Start Menu, All Programs, Microsoft Windows AIK, Deployment Tools Command Prompt to open up a command prompt window.

9. Type copy ..\x86\imagex.exe c:\ and press Enter.

10. Type COPYPE x86 c:\pe86 and press Enter.

11. Type copy c:\pe86\winpe.wim c:\pe86\ISO\sources\boot.wim and press Enter.

12. Type copy c:\imagex.exe c:\pe86\ISO and press Enter.

2. Make a bootable USB drive

1. Connect your USB drive to the USB port.
WARNING: All contents on the USB drive will be destroyed!

2. Double-click on RMPrepUSB.exe.

3. Set the following options:
SIZE = MAX (default)
WINPE (optional)
FILESYSTEM and OVERRIDES = FAT32 + HDD (Note: If you want to store image files >2GB on the UFD use NTFS instead of FAT32)
COPY FILES = Tick it
Copy Folder = Type

4. Click on Prepare Drive.

5. The USB drive should now contain:
\sources (Check whether the folder contains

6. Now you can add any other files you wish to the USB drive.

7. When finished, click the RMPrepUSB Eject button.

3. Boot the target system and take an image

The following actions are performed on the target system (the one that you want to take a backup of):

1. Connect the USB drive to the target computer's USB port.

2. Switch on the target computer and press the appropriate key to enter the BIOS Setup menu. (eg F1, F2, DEL)

3. Check whether the Legacy USB support is enabled, and configure the Boot Order so that the USB drive will boot first. Ensure that the BIOS USB-ZIP mode setting is set to Fixed Disk and not Removable Disk (if available).

4. Save and Exit the BIOS menu. The target system should now boot to the Windows WinPE environment from the USB drive.

5. To find the USB drive and hard disk drive letters - type NotePad, then click on File, Open and click on the Computer icon. You can now see how your hard disk volumes are lettered in WinPE. Assume that your USB Flash drive has the letter F: and you wish to backup your C: drive in the instructions below.

6. Exit from Notepad.

7. At the command prompt, type F:\imagex /capture c: f:\mybackup.wim "my comments here" /norpfix /check /verify and press Enter.

8. When this is completed, a backup of the C: drive is available in the mybackup.wim file.

9. If, at a later date, you wish to take another backup, you can append this to the previous backup as follows: imagex /append c: f:\mybackup.wim "second backup" /check /verify /norpfix
Note: ImageX using single-instancing, so adding subsequent similar images does not greatly increase the size of the .wim file.

You can backup other volumes from the hard disk, by following the above procedure.

4. Restoring an image

1. Boot to WinPE from the USB drive

2. Format the target drive volume first (otherwise the existing files will still remain). Eg Type format C:

3. Type imagex /apply f:\mybackup.wim 1 c: /check /verify
Note: If you want to restore the second backup that you made, replace the 1 with 2 in the above command.

If needed, you can use DISKPART to partition and format a blank hard disk first as follows.

DISKPART /s dpart.txt

where the file dpart.txt contains the lines:


In case of an XP image, type Bootsect /nt52 J: or you may see a 'bootmgr is missing' error when you attempt to boot the XP target system. The drive letters assigned in the diskpart script above are used to prevent conflicts with existing volume letters. When the system reboots, the active partition (J: in this example) will become drive C: and the other partition (K:) will be given the D: drive letter.

Note: The ALIGN=16065 text portion is needed only to boot a 'pre-setup stage' XP image (i.e. an image that will run Setup.exe or Setup32.exe when it boots). You can usually omit this portion of text for most Windows images.

Bootsect.exe can be found in the WAIK, under Tools\PETools\x86.
Before you reboot the system, you can also make any small adjustments to the files on the J: drive as you have direct access to these files (for instance, you could copy files or folders to drive J: or K: or add a link to the Windows Startup folder so that a program runs on first user log-in).

For instance, a simple prep.cmd script file to automatically install Windows XP image onto a new hard drive in approx. 5 minutes from a bootable WinPE USB flash memory pen drive would be as simple as:

diskpart /s dpart.txt
imagex /apply mybackup.wim 1 J:
bootsect /nt52 J:
echo Finished! - Press a key to reboot
wpeutil reboot

If you have problems booting to Windows 7 or Vista, you may have problems with the BCD. Boot to WinPE and use bcdedit /enum /v to view the BCD settings. To fix BCD boot issues, you can use the following procedure:

  1. del C:\boot\bcd
  2. bootrec /RebuildBcd
    Now test it to see if that worked - if not repeat step 1 and then skip to step 3 onwards...
  3. bcdedit.exe /createstore c:\boot\bcd.temp
  4. bcdedit.exe /store c:\boot\bcd.temp /create {bootmgr} /d "Windows Boot Manager"
  5. bcdedit.exe /import c:\boot\bcd.temp
  6. bcdedit.exe /set {bootmgr} device partition=C:
  7. bcdedit.exe /timeout 10
  8. del c:\boot\bcd.temp
    Now we have a clean, working bootloader. But we need to add a Vista/Win7 entry to it:
  9. bcdedit.exe /create /d "Windows Vista" /application osloader
    use "Windows Vista2 or "Windows 7" as appropriate
    bcdedit.exe should return a message with a GUID for the newly-created entry, something like this:
    The entry {c0dfc4fa-cb21-11dc-81bf-005056c00008} was successfully created.
    You'll need to use the value that bcdedit.exe returned for you below, along with the drive letter for the drive that Windows is installed to:
  10. bcdedit.exe /set /set {default} device partition=c:
  11. bcdedit.exe /set {default} osdevice partition=c:
  12. bcdedit.exe /set {bootmgr} device partition=c:
  13. bcdedit.exe /set {c0dfc4fa-cb21-11dc-81bf-005056c00008} path \Windows\system32\winload.exe
  14. bcdedit.exe /set {c0dfc4fa-cb21-11dc-81bf-005056c00008} systemroot \Windows
    And, last of all, tell the Vista/Win7 bootloader to boot the new entry by default:
  15. bcdedit.exe /displayorder {c0dfc4fa-cb21-11dc-81bf-005056c00008}
  16. bcdedit.exe /default {c0dfc4fa-cb21-11dc-81bf-005056c00008}

    Tip: Right-Click on the top-left command shell window icon and select Mark, then highlight the GUID in returned in step 8 and press {Enter}. The use the same icon to paste the GUID into the command line for step 9 and then use {UP-ARROW} to edit the command line for the next commands.

5. Connecting to the network

WinPE can connect to a network. You can then save and restore images directly from a network folder or your own computer. Check the example procedure given below:

In the example, we will connect to a shared folder on Fred's Windows XP office computer named 'FredsPC'. The read/write shared folder that Fred has made on his office PC has been named 'sharefld' and Fred is on the 'mydomain' network and has a username of 'freddy' and a password of 'mypassword'.

1. Connect an Ethernet cable and boot to WinPE from the USB drive prepared earlier.

2. Type IPCONFIG /all and check whether you have the valid IP address (not

3. If valid IP addresses are not listed, your WinPE operating system does not contain the correct drivers. To rectify this, copy the correct Windows 7 network driver files (INF/CAT/SYS etc) to your WinPE USB drive, e.g. to the folder F:\NETPE. Then on the target system, type