Walkthrough: Boot Windows PE from CD-ROM

Applies To: Windows 7, Windows Server 2008 R2

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

This walkthrough describes how to build a bootable Windows® Preinstallation Environment (Windows PE) CD or DVD media from RAM disk. For deployment or recovery, this method enables you to start a computer that has less than 512 megabytes (MB) of memory.

Prerequisites

To complete this walkthrough, you need the following:

  • A technician computer, which provides all the tools and the source files. For more information, see Building a Technician Computer.

  • CD burning software. The Windows OEM Preinstallation Kit (Windows OPK), the Windows Automated Installation Kit (Windows AIK), and Windows PE Kit do not include CD or DVD-burning software. However, you can obtain burning software from the Windows 2003 Resource Kit (cdburn and dvdburn tools) or use any third-party software.

  • A blank CD or DVD.

Step 1: Set up a Windows PE build environment

In this step, you will create a 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, right-click Deployment Tools Command Prompt, and then select Run as administrator.

    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.

  2. 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 a 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

  3. Copy the base image (Winpe.wim) into the \Winpe_x86\ISO\sources folder and rename the file to Boot.wim.

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

Step 2: Add boot support

In this step, you will add boot files to your Windows PE image. Before you can add files to the image, you must expand the image by using the DISM /Mount-Wim command.

  1. At the command prompt, apply the image to the \mount directory by using the DISM tool. For example,

    Dism /Mount-Wim /Wimfile:c:\winpe_x86\ISO\sources\boot.wim /index:1 /MountDir:C:\winpe_x86\mount

  2. Add the appropriate boot support files and directory. For example,

    copy c:\winpe_x86\ISO\bootmgr c:\winpe_x86\mount

    mkdir c:\winpe_x86\mount\boot

    xcopy /cherky  C:\winpe_x86\ISO\boot C:\winpe_x86\mount\boot\
    

Step 3: (Optional) Add additional customizations

This step is optional but recommended.

You can use ImageX to add applications and scripts to your Windows PE image that you might need while working in Windows PE.

ImageX is a tool for capturing and applying images during deployment scenarios. For example, at a command prompt, type:

copy "c:\program files\<version>\Tools\x86\ImageX.exe" c:\winpe_x86\mount

where <version> can be Windows OPK or Windows AIK and <architecture> can be x86, amd64, or ia64. In the previous example, the tools are not loaded into memory during a Windows PE RAM boot. The media must be available to access the tools.

Step 4: Configure BCD store

In this step, you create a new boot-configuration file, called BCD, by using BCDEdit. BCD, which replaces Boot.ini, is a command-line tool designed to manage BCD stores. BCDEdit is available in Windows PE and Windows® 7. For example,

Del c:\winpe_x86\mount\boot\BCD

Bcdedit /createstore c:\winpe_x86\mount\boot\BCD

Bcdedit /store c:\winpe_x86\mount\boot\BCD -create {bootmgr} /d "Boot Manager"

Bcdedit /store c:\winpe_x86\mount\boot\BCD -set {bootmgr} device boot

Bcdedit /store c:\winpe_x86\mount\boot\BCD -create /d "WINPE" -application osloader

The last command returns a GUID value. Substitute this value for <GUID> in the following examples.

Bcdedit /store c:\winpe_x86\mount\boot\BCD -set <GUID> osdevice boot

Bcdedit /store c:\winpe_x86\mount\boot\BCD -set <GUID> device boot

Bcdedit /store c:\winpe_x86\mount\boot\BCD -set <GUID> path \windows\system32\winload.exe

Bcdedit /store c:\winpe_x86\mount\boot\BCD -set <GUID> systemroot \windows

Bcdedit /store c:\winpe_x86\mount\boot\BCD -set <GUID> winpe yes

Bcdedit /store c:\winpe_x86\mount\boot\BCD -displayorder <GUID> -addlast

Step 5: Commit changes

In this step, you commit changes to the image. To commit changes to the original image file, use the Dism /Unmount option together with the /Commit option. For example:

Dism /Unmount-Wim /MountDir:C:\winpe_x86\mount /Commit

Step 6: Create a bootable CD or DVD

In this step, you put a Windows PE RAM disk onto a CD or DVD. This option requires that you create an .iso file by using the Oscdimg tool.

  1. On your technician computer, enter the following command to create an image (.iso) file for a BIOS-based computer. For example:

    Oscdimg -n -m -o -bC:\winpe_x86\Etfsboot.com C:\winpe_x86\ISO C:\winpe_x86\winpex86.iso
    

    where C:\winpe_x86\ISO is the location of the source files, and C:\winpe_x86\winpex86.iso is the destination .iso file.

    -or-

    For UEFI, replace Etfsboot.com with Efisys.bin, specify the EF platform ID, and add the following Universal Disk Format (UDF) options. For example:

    Oscdimg -bC:\winpe_x86\Efisys.bin -pEF –u2 -udfver102 C:\winpe_x86\ISO C:\winpe_x86\winpex86uefi.iso
    

    -or-

    For either BIOS or UEFI, enter the following command. For example:

    Oscdimg -m -o -u2 -udfver102 -bootdata:2#p0,e,bC:\winpe_x86\Etfsboot.com#pEF,e,bC:\winpe_x86\Efisys.bin C:\winpe_x86\ISO C:\winpe_x86\winpex86uefi.iso
    

    where this command starts the Etfsboot.com boot file for a BIOS image, and then starts the Efisys.bin boot file for a UEFI image.

  2. Burn the image file onto a CD or DVD.

See Also

Concepts

Walkthrough: Boot Windows PE from a BIOS-based Hard Disk
Walkthrough: Boot Windows PE from a UEFI-based Hard Disk
Oscdimg Command-Line Options