Building the WinPE Image

7/28/2010 9:23:23 AM
Building the WinPE Image
After you have installed MSXML (if needed) and WAIK, take the following steps:
  1. Open a WinPE Tools command prompt by clicking Start:All Programs: Microsoft Windows AIK:Windows PE Tools Command Prompt.

  2. Copy the WinPE source files to a temporary directory by typing the following command in the PE Tools command prompt

    copype.cmd x86 c:\winPE_x86

    Note that if you want to build a 64-bit WinPE disk, you use x64 instead of x86 throughout. We will use x86 in the remainder of these instructions for simplicity.

  3. Next, you want to mount your image to a directory so you can customize it. You do that with the following command:

    imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount

    The mount directory is essentially a link to what is in the WIM file that allows you to read and write its contents. You use that to add additional tools and packages to the image.

  4. Add features. WinPE comes with a number of features that are not installed by default to save space. This includes language packs and additional features. If you have enough space, say half a gigabyte, it is worth it to install all of them. Table 1 lists the packages that are included with WinPE.

    Table 1: Packages Included with WinPE
    Open table as spreadsheet




    HTML application support


    Microsoft Data Access Component support


    Windows Script Host support


    Microsoft XML (MSXML) parser support


    Windows Management Instrumentation support


    Japanese font support


    Korean font support


    Chinese simplified (People's Republic of China) font support


    Chinese traditional, Hong Kong SAR font support


    Chinese traditional, Republic of China font support

    To install the packages, run the following command once for each package:

    peimg /install= c:\winpe_x86\mount\Windows

You can install all the packages by using * instead of :

  1. If you need to install custom drivers this would be the time to do it. You can do that with the peimg command as well, using the /inf switch. You should do this, for example, if you want a network-ready WinPE image using a network card that does not have a driver in the standard image.

  2. You can add your own custom tools by copying them into the c:\winpe_x86\ISO directory. You may also want certain other tools, such as the imagex tool used to capture and apply installation images just as you did before, and the Package Manager tool that is used to service those images. Copy those latter two using these commands:

    copy "c:\Program Files\Windows AIK\Tools\x86\imagex.exe" Image from book
    xcopy "c:\Program Files\Windows AIK\Tools\x86\Servicing" Image from book
    c:\winpe_x86\iso\Servicing /s
    copy %windir%\system32\msxml6*.dll c:\winpe_x86\iso\Servicing

    If you so desire, you can put the utilities in Step 6 in the mount directory instead of the iso directory. The iso directory is mounted using the first available drive letter when you boot into WinPE. If you put the tools in the mount directory instead, they will be loaded into the RAM disk that WinPE is loaded into and will be accessible using the X: drive under WinPE just like the tools included by default. This obviously increases the size of the image in memory, however. Because you are planning to run WinPE from a USB flash drive, the speed difference is so marginal, we see no need to increase the memory footprint further.

  3. Prepare your image. Preparing your image optimizes it and removes any options that you do not need. For example, in our test used to develop these instructions, the image was 1.1GB on disk before running the prep command:

    peimg /prep c:\winpe_x86\mount\Windows

    After running peimg /prep, the image size is down to 685MB.

  4. Commit your changes and finalize the image. You do that using this command:

    imagex /unmount c:\winpe_x86\mount /commit

    This makes your changes permanent and unmounts the image. If you do not do this you will lose all the changes you have made and you will leave a large number of files in the mount directory locked open so that you cannot delete them.

  5. Finalize your ISO directory by taking the changes you have made to the original image and copying them into the ISO directory where all your source files for your WinPE image now sit:

    copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim
  6. You now have a complete WinPE image. You can do a number of things with it

    • Create an ISO image. Having an ISO image with WinPE is convenient because it is an easy way to distribute the image. You can also use it to boot virtual machines by mounting the ISO image as a CD. To create an ISO image, run this command:

      oscdimg -n -bc:\winpe_x86\ c:\winpe_x86\ISO Image from book

As you are probably aware, to have a bootable ISO image you must have a boot sector. Fortunately, the boot sector comes with WinPE; it is the file.

  • If you are of the old school and want a CD copy of your WinPE image you can burn the ISO image to CD with your favorite CD burning program.

  • Create a bootable WinPE image on a USB flash drive. This is by far the coolest way to use WinPE. You need a 256MB or larger flash drive to do this. The steps for how start in Step 11.

  1. Plug your USB flash drive into a computer running Windows Vista. It is very important that the computer run Windows Vista. Diskpart in Windows Server 2003 and earlier does not support manipulating USB flash drives.

  2. You need to prepare the USB flash drive using diskpart, the disk partitioning tool. Start that tool by typing diskpart at a command line. If you have not elevated the command prompt already, you will be asked to do so now.

  3. Partition and prepare your USB flash drive using these commands

    1. List disk: This lists the disks in your computer. You do this only to ensure that you know which one is your USB flash drive. Take care here. The next few steps will completely erase the drive! You do not want to do this with the wrong drive.

    2. Select disk : Substitute the disk number shown for your USB flash drive in Step 13 a for . Again, make sure you get this one right!

    3. Clean: This command zeros every sector on the disk. In other words, it is a completely destructive wipe so you need to be careful in Step 13 b.

    4. Create partition primary: This creates a primary (bootable) partition on the USB flash drive.

    5. Select partition 1: Selects your partition so you can manipulate it further.

    6. Active: Marks the partition as active (the partition holding the boot files).

    7. Format fs=fat32: Formats the partition using the Fat32 file system.

    8. Assign: Assigns a drive letter to your new partition in case it had not already been done. Usually it is already done.

    9. Exit: Quits diskpart. You now have a formatted, empty, bootable USB flash drive. Only the files you want to put on it are missing.

  4. Copy the files in the ISO folder to the USB flash drive. You can do this via Windows Explorer, or by using this command in the command prompt you already have open:

    xcopy c:\winpe_x86\iso\*.* /s /e \i
    where is the drive letter assigned to your USB flash i

Congratulations! You now have a bootable Windows PE image. This is one of the most useful little tools you can have in your bag for troubleshooting or repairing Windows. You can also use it to flash BIOS files, prepare disks, and for a host of other tasks. We're sure you will think of things we had not imagined.

Top 10
Review : Sigma 24mm f/1.4 DG HSM Art
Review : Canon EF11-24mm f/4L USM
Review : Creative Sound Blaster Roar 2
Review : Philips Fidelio M2L
Review : Alienware 17 - Dell's Alienware laptops
Review Smartwatch : Wellograph
Review : Xiaomi Redmi 2
Extending LINQ to Objects : Writing a Single Element Operator (part 2) - Building the RandomElement Operator
Extending LINQ to Objects : Writing a Single Element Operator (part 1) - Building Our Own Last Operator
3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
Popular Tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8