Windows 7 / Getting Started

Customizing a Windows PE Image

You can customize a mounted boot or installation image using the DISM utility. You work with mounted images by using the subcommands of Dism /image. DISM options designed for servicing Windows PE images are listed in Table below. Some other options can be used with Windows PE as well, and you'll find a complete list of other available options later in the tutorial.

Common DISM Options for Windows PE Images

OPTIONDESCRIPTIONEXAMPLE
/Get-PESettingsDisplays a list of Windows PE settings in the mounted Windows PE image. The list includes current profiling state, scratch space settings, and target path settings.Dism /image:C:\winpe_x86\ mount /Get-PESettings
/Get-ProfilingDisplays the status of the profiling feature.Dism /image:C:\winpe_x86\ mount /Get-Profiling
/Get-ScratchSpaceDisplays the configured amount of Windows PE system volume scratch space. This setting represents the amount of writable space available on the Windows PE system volume when booted in RAM disk mode.Dism /image:C:\winpe_x86\ mount /Get-ScratchSpace
/Get-TargetPathDisplays the target path of the Windows PE image. The target path represents a path to the root of the Windows PE image at boot time.Dism /image:C:\winpe_x86\ mount /Get-TargetPath
/Set-ScratchSpace:SizeSets the available scratch space in megabytes. Valid values are 32, 64, 128, 256, and 512.Dism /image:C:\winpe_x86\ mount /Set-ScratchSpace:256
/Set-TargetPath:PathWhen you are booting to a hard disk, this option sets the location of the Windows PE image on the disk. The path must start with a letter (any letter from C to Z) and must be followed by :\.Dism /image:C:\winpe_x86\ mount /Set-TargetPath:X:\
/Enable-ProfilingEnables profiling so that you can create your own profiles. By default, profiling is disabled.Dism /image:C:\winpe_x86\ mount /Enable-Profiling
/Disable-ProfilingTurns off profiling.Dism /image:C:\winpe_x86\ mount /Disable-Profiling
/Apply-Profiles:PathApplies a profile and removes files that are not used in the custom profile. Critical boot files are not deleted. A Windows PE image that has been customized using any profile is not serviceable.Dism /image:C:\winpe_x86\ mount /Apply-Profiles: C:\profiles\prof.txt

If you mount an image using the following command:

imagex /apply c:\winpe_x86\iso\sources\boot.wim 1 c:\winpe_x86\mount\

you'll work with the image via the mount point:

c:\winpe_x86\mount\

All Windows PE images have the following settings:

  • profiling status Specifies whether profiling is enabled or disabled.
  • Scratch space Specifies the amount of memory to allocate to the Windows PE work space, such as 32 MB.
  • target path Specifies the target path used when you boot the Windows PE image, such as X:\.

To review the settings of the mounted image, enter the following command:

dism /image:ImagePath /Get-PESettings

where ImagePath is the path to the image you've mounted, such as:

dism /image:c:\winpe_x86\mount\ /get-pesettings

By default, Windows PE allocates 32 MB of writable memory for its work space. You can increase the work space up to 512 MB by typing the following at a command prompt:

dism /image:ImagePath /Set-ScratchSpace:Size

where ImagePath is the path to the image you've mounted, and Size is the work space size in megabytes. Valid values for Size are 32, 64, 128, 256, and 512. The following example sets the work space to 128 MB:

dism /image:c:\winpe_x86\mount\ /Set-ScratchSpace:128

You might want to increase the amount of memory allocated to the work space if you plan to use profiling or run nonstandard applications in the Windows PE environment. If Windows PE runs out of memory, applications might become unresponsive.

There are many other things you can do with Windows PE images. You can get information about all installed drivers by entering the following command:

dism /image:c:\winpe_x86\mount\ /get-drivers /all

Note When a DISM option expects you to provide a working value, follow the option name with a colon and then specify the required value. Don't insert a space between the colon and the value.

To add a third-party driver to Windows PE images, you use /Add-Driver. The basic syntax is:

dism /image:MountPoint /add-driver /Driver:InfPath

where MountPoint is the path where the image is mounted, and InfPath is the path for the .inf file for the driver, for example:

dism /image:c:\winpe_x86\mount\ /add-driver
/driver:c:\drivers\remmedia\rem.inf

If a common folder has subdirectories containing drivers to add, you can specify the base folder to search recursively by using the following syntax:

dism /image:MountPoint /add-driver /driver:BaseFolder /recurse

where MountPoint is the path where the image is mounted, and BaseFolder is the folder to search for drivers, such as:

dism /image:c:\winpe_x86\mount\ /add-driver /driver:c:\drivers /recurse

Tip With x64 and Itanium-based computers, you must use signed drivers by default. to force DISM to accept unsigned drivers, add the /ForceUnsigned option.

To add applications to a Windows PE image, simply use Copy or Xcopy to copy the necessary application files to the appropriate subdirectory. For example, you can copy Imagex.exe to the root directory of the image by using the following command:

xcopy "C:\Program Files\Windows AIK\Tools\x86\Imagex.exe"
c:\winpe_x86\mount\

You can get information about packages installed in a Windows PE image by using the /Get-Packages option. The basic syntax is:

dism /image:MountPoint /get-packages

such as:

dism /image:c:\winpe_x86\mount\ /get-packages

To add packages, you use the /Add-Package option. The available packages you can install include those listed in Table below. The basic syntax for adding packages is:

dism /image:MountPoint /add-package /PackagePath:PathtoCab

Here is an example:

dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\
Windows AIK\Tools\PETools\x86\WinPE_OCs\winpe-wmi.cab"

Common Windows PE Packages

PACKAGE NAMEDESCRIPTION
WinPE-FONTSupport-Language.cabInstalls fonts for the specified language: ja-jp, ko-kr, zh-cn, zh-hk, or zh-tw
WinPE-HTA.cabInstalls HTML application support
WinPE-LegacySetup.cabInstalls the legacy setup package
WinPE-MDAC.cabInstalls Microsoft Data Access Component support
WinPE-Scripting.cabInstalls Windows Script Host support
WinPE-Setup-Client.cabInstalls the client setup package (as long as you have already installed the main setup package)
WinPE-Setup.cabInstalls the main setup package
WinPE-Setup-Server.cabInstalls the server setup package (as long as you have already installed the main setup package)
WinPE-SRT.cabInstalls the Windows Recovery Environment component (Windows OPK only)
WinPE-WDS-Tools.cabInstalls the Windows Deployment Services tools package
WinPE-WMI.cabInstalls Windows Management Instrumentation (WMI) support

The base Windows PE image does not contain all the packages listed in the table. You must use the DISM tool to install the additional packages you want to use. The packages are located in the \Windows OPK\Tools\PETools\ProcType or \Windows AIK\Tools\PETools\ProcType directory, where ProcType is amd64, ia64, or x86. When you install font support for additional languages, be sure the required language resources are installed on the client computer. The language resources are located in a language-specific subfolder of the \Windows OPK\Tools\PETools\ProcType or \Windows AIK\Tools\PETools\ProcType directory.

Once you install language support, you can specify the user interface language you want by using the /SetUILang option. For example, if you want to use U.S. English, enter:

dism /image:c:\winpe_x86\mount /Set-UILang:en-US

You can verify the language settings by using the /Get-Intl option, such as:

dism /image:c:\winpe_x86\mount /Get-Intl

After you have made all the necessary changes, you can unmount the image and commit your changes. The basic syntax is:

imagex /unmount MountPath /commit

Here is an example:

imagex /unmount c:\winpe_x86\mount /commit

Note If you unmount an image without committing the changes, your changes will be discarded.

Now you have a customized Windows PE image. You can replace the default Windows PE image in the ISO directory with your customized image by entering the following command:

copy c:\winpe_x86\boot.wim c:\winpe_x86\ISO\sources\boot.wim
[Previous] [Contents] [Next]