Windows 7 / Getting Started

Capturing and Optimizing a Build

After your Windows PE image is ready, you can use the following ImageX command to capture the image into a Windows Imaging (.wim) file:

imagex /boot /capture c:\winpe_x86\mount c:\winpe_x86\iso\sources\boot.wim
"Primary WinPE Build"

Here, the /Boot option marks the image as bootable, and the /Capture option captures the contents of C:\Winpe_x86\Mount and creates an image file in the C:\Winpe_x86\ISO\Sources directory. "Primary WinPE Build" is the descriptive name of the bootable image file (Boot.wim).

Note WIM images can be bootable or installable. Generally, bootable images, used with Windows pe, are stored in Boot.wim files, and installable images, used to deploy Windows, are stored in Install.wim files. Install.wim files can include multiple editions of Windows. the standard Windows 7 distribution media contains a Boot.wim file and an Install.wim file. the Boot.wim file loads Windows pe to start the computer and prepare for installation. the Install.wim file contains the Windows image needed to install Windows 7.

The ISO\Sources directory is a standard build directory used for staging Windows PE images. The ISO directory also has Boot and EFI subdirectories, which are required for creating bootable media. After you've staged the boot image, you can create bootable media that uses the image or you can import the image into Windows Deployment Services.

Optimizing a Build

Profiling tracks the required components for a build and then allows you to optimize a build image. To use profiling, you must install the WinPE-WMI package and enable the feature by using the /Enable-Profiling option in the Windows PE image. Enabling profiling turns on logging of the files and features that are used when you boot to the Windows PE image.

After you boot to the Windows PE image, test all the features you are going to use in the actual environment. Testing the features shows the related files as being used in the profile log. You can save the profile using Wpeutil SaveProfile before ending the Windows PE session. The basic syntax is:

wpeutil saveprofile SaveLocation "Description"

where SaveLocation is the file path where the profile should be stored, and Description is a description of the profile, for example:

wpeutil saveprofile x:\st-profile.txt "Optimization Profile"

Next, you need to mount the image and apply the profile. The basic syntax for applying a profile to a mounted image is:

dism /image:ImagePath /apply-profiles:ProfilePath

where ImagePath is the path to the image you've mounted, and ProfilePath is the path to the profile you want to use to optimize the image, such as:

dism /image:c:\winpe_x86\mount\ /apply-profiles:c:\st-profile.txt

Once you've optimized the image, unmount the image and commit the changes. Note that applying a profile turns off the profiling features and marks the image so that it can no longer be serviced.

[Previous] [Contents] [Next]