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 A-1 lists the packages that are included with WinPE.

    Table A-1: Packages Included with WinPE
    Open table as spreadsheet

    PACKAGE NAME

    PACKAGE CONTENTS

    WinPE-HTA-Package

    HTML application support

    WinPE-MDAC-Package

    Microsoft Data Access Component support

    WinPE-Scripting-Package

    Windows Script Host support

    WinPE-XML-Package

    Microsoft XML (MSXML) parser support

    WinPE-WMI-Package

    Windows Management Instrumentation support

    WinPE-FontSupport-JA-JP-Package

    Japanese font support

    WinPE-FontSupport-KO-KR-Package

    Korean font support

    WinPE-FontSupport-ZH-CN-Package

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

    WinPE-FontSupport-ZH-HK-Package

    Chinese traditional, Hong Kong SAR font support

    WinPE-FontSupport-ZH-TW-Package

    Chinese traditional, Republic of China font support

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

     peimg /install=<package name> c:\winpe_x86\mount\Windows 

You can install all the packages by using * instead of <package name>:

  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 c:\winPE_x86\ISO\servicing 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\etfsboot.com c:\winpe_x86\ISO image from book c:\winpe_x86\winpe_x86.iso 

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 http://www.etfsboot.com 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 <disk number>: Substitute the disk number shown for your USB flash drive in Step 13 a for <disk number>. 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 <drive letter>\i where <drive letter> is the drive letter assigned to your USB flash i drive. 

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.



Windows Vista Security. Securing Vista Against Malicious Attacks
Windows Vista Security. Securing Vista Against Malicious Attacks
ISBN: 470101555
EAN: N/A
Year: 2004
Pages: 163

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net