Share via


Create a Custom Windows 7 PE RAM Disk

Creating a Custom Windows 7 PE RAM Disk

Note: This walkthrough is a rewrite of the following article located here: http://technet.microsoft.com/en-us/library/cc709665%28WS.10%29.aspx**. **I chose to rewrite it to reflect the changes that have taken place in the newer Windows 7 AIK toolkit. So if you are using the new version and receive “peimg is not a valid command error” this is for you. Most of the original library article is still valid except for step 3 which is fixed in this article, and a few small minor edits here an there.

Step 1: Set up a Windows PE Build Environment

In this step, you create a required directory structure that supports building a Windows PE image.

  1. On your technician computer, click Start, point to All Programs, point to Windows OPK or Windows AIK, and then click Deployment Tools Command Prompt.
    The menu shortcut opens a Command Prompt window and automatically sets environment variables to point to all the necessary tools. By default, all tools are installed at C:\Program Files\version\Tools, where version can be Windows OPK or Windows AIK.
  1. At the command prompt, run the Copype.cmd script. The script requires two arguments: hardware architecture and destination location. For example,

copype.cmd <architecture> <destination>

where <architecture> can be x86, amd64, or ia64 and <destination> is a path to the local directory. For example,

copype.cmd x86 c:\winpe_x86

The script creates the following directory structure and copies all the necessary files for that architecture. For example,

\winpe_x86

\winpe_x86\ISO

\winpe_x86\mount

 

Step 2: Mount the Base Windows PE Image

In this step, you mount the base image to a local directory so that you can add or remove packages.

  • At the command prompt, mount the base Windows PE image (Winpe.wim) to the \Mount directory by using ImageX. For example,

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

Step 3: Add Additional Packages

This is where using the newer Windows 7 AIK tools differs from the older versions; you are no longer using tools like “peimg” since they have been incorporated into DISM.

By using the Dism tool, you can install Windows features by using the /image option. Windows features are included with the base image (Winpe.wim) but are not installed. You can also import packages and add drivers and language packs.

Add a Windows feature to the base image by using the Dism /image: command. For example,

dism /image:c:\winpe_x86\mount /add-package /packagepath:”c:\program files\windows aik\tools\petools\x86\WinPE-HTA.cab”

Note: all spaces and colons must be “as shown” above. Also I have only shown the x86 folder path option but that can be replaced with the ia64 or amd64 folder path options

Package Name

Description

WinPE-FONTSupport-<region>-Packages

Additional font support for ja-jp, ko-kr, zh-cn, zh-hk, and zh-tw.

WinPE-HTA-Package

HTML application support

WinPE-MDAC-Package

Microsoft Data Access Component support

WinPE-Scripting-Package

Windows Script Host support

WinPE-SRT-Package

Windows Recovery Environment component (available only on the Windows OPK)

WinPE-WMI-Packages

Windows Management Instrumentation (WMI) support

WinPE-XML-Package

Microsoft XML (MSXML) parser support

Repeat for each package you wish to add to your mounted wim file.

Step 4: (Optional) Add Additional Customizations

This step is optional but recommended. You can add applications and scripts to your Windows PE image that you might need while working in Windows PE. The following is a list of common tools to include in your Windows PE image.

  • ImageX
    A command-line tool for capturing and applying images during deployment scenarios. For example, at a command prompt,

copy “c:\program files\version>\Tools\x86\imagex.exe” c:\winpe_x86\iso\

  • Package Manager (Pkgmgr.exe)
    A tool for servicing Windows image (.wim) files offline. You must copy the entire \Servicing folder and MSXML6 binaries. Offline servicing requires ImageX. For example,

xcopy “c:\program files\version>\Tools\architecture>\Servicing” c:\winpe_x86\iso\Servicing /s

 

copy %windir%\system32\msxml6*.dll c:\winpe_x86\iso\Servicing
where <version> can be Windows OPK or Windows AIK and <architecture> can be x86, amd64 or ia64. In both previous examples, the tools are not loaded into memory during a Windows PE RAM boot. The media must be available to access the tools.
To load the tools into memory along with Windows PE, copy the source files into the mounted \Windows directory. For example,

 

c:\winpe_x86\mount\Windows

 

Step 5: Prepare the Image

In this step, you prepare the image by using the Dism or Imagex /cleanup command. This operation removes any non-installed or corrupt packages from the final image. This operation can reduce the overall image size. For example,

dism /cleanup
or
Imagex /cleanup

The /cleanup option cannot be reverted.

Step 6: Commit Changes to the Image

In this step, you commit the changes to the original image file (Winpe.wim) by using the ImageX /unmount option with the /commit option. For example,

imagex /unmount c:\winpe_x86\mount /commit

Step 7: Replace the Default Boot.wim File

In this step, you replace the default Boot.wim in the \ISO directory with your new customized image. The image must be called Boot.wim. For example,

copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim

Step 8: Burn the image

You now have a customized Windows PE RAM disk image that you can place on bootable media, like a CD-ROM or a UFD.

To create a bootable CD-ROM

  1. On your technician computer, at a command prompt, create an .iso file by using Oscdimg. For example,
oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso

For IA-64 architecture, replace Etfsboot.com with Efisys.bin.

  1. Burn the image (Winpe_x86.iso) to a CD-ROM.

To create a bootable UFD

  1.    During a running Windows Vista operation system or a Windows PE session, insert your UFD device.
  2.    At a command prompt, use Diskpart to format the device as FAT32 spanning the entire device, setting the partition to active. For example,
3.      diskpart
4.      select disk 1
5.       clean
6.      create partition primary size=<size of device>
7.      select partition 1
8.      active
9.      format fs=fat32
10.    assign
 exit

where the value of disk 1 is equal to UFD.

  1. On your technician computer, copy all the content in the \ISO directory to your UFD device. You can manually create the directory structure or use the xcopy command to automatically build and copy the appropriate files from your technician computer to your UFD device. For example,
xcopy c:\winpe_x86\iso\*.* /s /e /f f:\

where c is the letter of your technician computer hard disk and f is the letter of your UFD device.

You can further customize your Windows PE image by adding language packs, customized scripts, and drivers. For more information, see Windows PE Customization How-To Topics in the TechNet Library.