Академический Документы
Профессиональный Документы
Культура Документы
Booting Windows PE
After creating a custom Windows PE image, you must decide how the image will boot up and where it will
run from. The first method is booting from a removable media into random access memory (RAM) and
then running directly from a RAM disk. The second method is booting and running directly from a CD or
the hard disk.
There are five methods of starting Windows PE by using a RAM disk. You can create bootable
Windows PE RAM disk images on:
• CD-ROM.
• A USB flash drive (UFD).
• A hard disk.
• A Windows Deployment Services (Windows DS) server. You can access the image by way of PXE
boot.
• A supported PXE server. You can access the image by way of PXE boot.
Normally, when you start a computer from a hard disk drive, a CD-ROM, or a Windows DS (PXE) server,
Windows keeps operating system file handles open and dedicated to that instance of Windows. Therefore,
you cannot remove the CD that you used to start the computer and insert another CD. You cannot delete
the hard disk partition from which you started the computer. The Windows DS (PXE) server that is used to
start the computer must keep those file handles open, and Windows PE client computers cannot be
detached from the network without causing Windows PE to become unstable.
The size of Windows PE enables the entire Windows PE operating system image to load into random
access memory (RAM) and to start the computer from a RAM disk. The RAM disk boot feature provides a
virtual CD file system in memory.
The Windows operating system Setup Loader now supports loading Windows PE from a RAM disk. The
RAM disk driver supports loading an ISO-9660 (CD) image as a RAM disk. Booting Windows PE from a
RAM disk enables you to:
• Swap the CD that is used to start the computer and insert another CD to add drivers, utilities,
applications, or a Windows operating system image.
• Start the computer from a Windows DS (PXE) server with the ability to disconnect from the
network once Windows PE has loaded. After the initial download of the Windows PE image, there
is no longer any dependency on network resources, such as file handles, which normally must
remain loaded until the Windows PE client computer restarts.
• Delete and repartition the hard disk from which Windows PE has just started.
• Decrease total boot time.
Note
Windows PE assigns X as the drive letter of any media that it boots from, and the assignment cannot
be modified.
Requirements
The following items are required for starting Windows PE by using a RAM disk:
• An x86, amd64, or IA64-based computer.
• A bootable Windows PE image created from a Windows PE 2.0 base image.
• A minimum of 512 megabytes (MB) of RAM when using the default Windows PE disk image
If you use a customized RAM disk image, the computer's RAM must be at least 100 MB more than
the size of the customized RAM disk image. If there is not enough RAM to store the RAM disk
image and to start the operating system, Windows PE will fail to boot.
Copy Code
imagex /apply WinPE.wim 1 C:\myWinPE
2. Using the peimg /list command to see which packages are installed and available for
installation. For example,
Copy Code
peimg /list C:\myWinPE\Windows
3. Adding drivers, packages, and language packs as appropriate by using peimg /install
command. For example, to add the HTA package,
Copy Code
peimg /install=WinPE-HTA-Package C:\myWinPE\Windows
4. Copying any additional files or tools that you intend to include in the image. For
example,
Copy Code
C:\myWinPE\Program Files\myapp\myapp.exe.
5. Preparing the image by using the peimg /prep command. This command will remove
any packages and language packs that are not designated for the final image. For
example,
Copy Code
peimg /prep c:\myWinPE\Windows
6. Capturing the new bootable image by using ImageX. For example,
Copy Code
imagex /boot /compress max /capture c:\myWinPE c:\boot.wim "My Winpe Image"
The customized image is now ready to be copied or burned to bootable media. The most common method
is to create an .iso file and then burn the image onto a CD-ROM. For more information about bootable
methods, see Booting Windows PE.
Supported Packages
Windows PE 2.0 provides the following optional packages:
WinPE-FONTSupport-<region>-Packages Additional font support for ja-jp, ko-kr, zh-cn, zh-hk, and zh-tw.
Note
The base Windows PE image (Winpe.wim) contains all the packages listed above, but they are
not installed. They are only staged. You must use the PEImg tool to install the appropriate
packages. When you run the peimg /prep command, packages that are not installed will be
removed from the final image.
Supported Customizations
Windows PE 2.0 supports the following customizations:
• Adding and removing packages and language packs from the base image.
• Adding third-party drivers and third-party components.
• Adding Windows PE updates.
• Adding out-of-box Windows PE language packs.
• Customizing temporary storage.
Limitations
Once the peimg /prep command is applied to an image, the image is final. You can no longer add or
remove packages. However, you can still add drivers and language packs.
Note
It is recommended that you recapture and save a copy of the image prior to running the
peimg /prep command. This ensures that you have a customized base image that you can
later modify. You must then reapply your customized base image, run the peimg /prep
command against the image to optimize for size, and then recapture the new image.
Note
This method enables you to boot directly into memory and assigns the drive letter X, which does not
correspond to the media (USB flash drive or CD-ROM) from which you booted. Ensure that you have
sufficient memory to support the size of your Windows PE image plus any additional memory
requirements, for example, if you plan on running any customized applications that need additional working
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-ROM burning software. The Windows OPK, Windows AIK, and Windows PE Kit do not
include CD-ROM or DVD-ROM burning software. However, you can obtain burning software
from the Windows 2003 Resource Kit (cdburn and dvdburn) or use any third-party software.
• A blank CD-ROM.
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 Windows PE 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.
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
Copy Code
[ExclusionList]
ntfs.log
hiberfil.sys
pagefile.sys
"System Volume Information"
RECYCLER
Windows\CSC
[CompressionExclusionList]
*.mp3
*.zip
*.cab
\WINDOWS\inf\*.pnf
You can add additional files or directories that you intend to exclude during a capture operation.
For more information about configuration files, see Create an ImageX Configuration File.
2. Save the configuration file to the same location as ImageX as specified in Step 2. For example,
Copy Code
c:\winpe_x86\iso\
ImageX will automatically detect wimscript.ini only if it is saved to the same location.
Step 4: Create a bootable CD-ROM
This step describes how to put a Windows PE RAM disk onto a CD-ROM. This option requires that you
create an .iso file by using the Oscdimg tool.
1. On your technician computer, create an .iso file with Oscdimg. At a command prompt, type:
Copy Code
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.
2. Burn the image (Winpe_x86.iso) onto a CD-ROM.
Note
This method boots directly into memory and is assigned the drive letter X, which does not correspond to the
media (UFD, CD-ROM) from which you booted. Ensure that you have sufficient memory to support the
size of your Windows PE image plus any additional memory requirements, for example, if you plan on
running any customized applications that need additional working memory.
Important
If you use a UFD device to initiate a Windows Vista installation, you must leave the UFD device in the
computer until Windows Vista Setup has successfully completed the Windows PE phase of setup. If you
remove the UFD device prior to disk configuration (Windows PE phase), setup fails.
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.
• Access to a computer running Windows Vista or a Windows PE session.
• A UFD device. The size of the UFD device must be at least 64 megabytes (MB) larger than your
Windows PE image plus any additional files that you include.
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 Windows PE 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.
2. At the command prompt, run the Copype.cmd script. The script requires two arguments: hardware
architecture and destination location.
Copy Code
copype.cmd <arch> <destination>
where <arch> can be x86, amd64, or ia64 and <destination> is a path to local directory. For
example,
Copy Code
copype.cmd x86 c:\winpe_x86
Running 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: 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 are common tools to include in your
Windows PE image.
• ImageX
A tool for capturing and applying images during deployment scenarios. For example,
Copy Code
copy “c:\program files\<version>\Tools\x86\imagex.exe” c:\winpe_x86\iso\
• Package Manager (Pkgmgr.exe)
A tool for servicing Windows images (.wim) offline. You must copy the entire \Servicing folder
and MSXML 6 binaries. Offline servicing requires ImageX. For example,
Copy Code
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 examples, the tools are not loaded into memory during a Windows PE RAM boot. The media must
be available to access the tools.
Step 3: Create an exclusion list
This step is optional but recommended if you include ImageX as part of your Windows PE image. During
an ImageX capture operation, some files might be locked, which causes ImageX to fail. You can exclude
specific files from being captured by creating a configuration text file called Wimscript.ini. The following
is a sample configuration file that includes common files that you must exclude during a capture operation.
Copy Code
[ExclusionList]
ntfs.log
hiberfil.sys
pagefile.sys
"System Volume Information"
RECYCLER
Windows\CSC
[CompressionExclusionList]
*.mp3
*.zip
*.cab
\WINDOWS\inf\*.pnf
Add additional files or directories that you intend to exclude during a capture operation. For more
information about configuration files, see Create an ImageX Configuration File.
Save the configuration file to the same location as ImageX as specified in Step 2. For example,
Copy Code
c:\winpe_x86\iso\
ImageX will automatically detect Wimscript.ini only if it is saved to the same location.
Step 4: Prepare UFD device
Before you can place Windows PE on a USB flash drive (UFD) device, you must use Diskpart to format
the UFD with a Windows Vista or Windows PE environment.
1. From a running Windows Vista operation system or Windows PE session, insert your UFD device.
2. At a command prompt, use Diskpart to format the device as FAT32 spanning the entire device, and
set the partition as active. For example,
Copy Code
diskpart
select disk 1
clean
create partition primary size=<size of device>
select partition 1
active
format fs=fat32
assign
exit
The example above assumes Disk 1 is the UFD.
3. On your technician computer, copy all the content in the \ISO directory onto your UFD device. You
can manually create the directory structure or use the xcopy command to automatically build and to
copy the appropriate files from your technician computer to your UFD device. For example,
Copy Code
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.
Walkthrough: Create a Bootable Windows PE RAM Disk
on Hard Disk
This walkthrough describes how you can create a bootable Windows PE RAM disk on a hard disk by using
Windows PE RAM Disk media (such as a USB flash drive or CD-ROM). Staging Windows PE RAM on
hard disk enables a number of different scenarios, including deployment, recovery, and diagnostics.
Windows PE RAM boots directly into memory, enabling you to reformat or to modify the hard drive after
boot. In this example, you build a Windows PE RAM Disk CD-ROM or UFD media. You use the bootable
media to start the new computer, format the hard drive, and then copy the Windows PE source files to the
hard drive.
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.
• A blank CD-ROM and CD-ROM-burning software, if you chose to create a Windows PE CD.
• A USB flash drive (UFD) device if you are creating a bootable UFD device. You will need access
to a computer running Windows Vista.
Step 1: Create a bootable Windows PE RAM media
Select one of these options and follow the instructions for building a bootable Windows PE RAM media.
After you create your bootable media, continue to the next step.
• Walkthrough: Create a Bootable Windows PE RAM Disk on CD-ROM
• Walkthrough: Create a Bootable Windows PE RAM Disk on UFD
Step 2: Prepare the hard drive
Boot the new computer with your Windows PE media and format the hard drive.
1. On the new computer, insert your Windows PE media and restart the computer.
Windows PE will start and will launch the Command Prompt window.
Note
If the hard drive contains an active partition, you must override the boot order to boot from the
CD/DVD-ROM drive. During initial boot, select the appropriate function key to override the boot
order. If this is a new computer, the hard drive will be unformatted, and you can skip this step.
2. Format the hard drive by using DiskPart.
Windows PE RAM Disk requires an active partition with a size no less than the size of your
Windows PE image. At a command prompt, type:
Copy Code
diskpart
select disk 0
clean
create partition primary size=350
select partition 1
active
format
exit
Copy Code
xcopy d:\*.* /s /e /f c:\
where d is the letter of your CD-ROM drive or UFD media and c is the letter of your hard disk.
Important
If you are running Windows Vista, you must select run as Administrator.
2. 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.
3. At the command prompt, run the Copype.cmd script. The script requires two arguments: hardware
architecture and destination location. For example,
copype.cmd <arch> <destination>
where <arch> 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
Copy Code
[ExclusionList]
ntfs.log
hiberfil.sys
pagefile.sys
"System Volume Information"
RECYCLER
Windows\CSC
[CompressionExclusionList]
*.mp3
*.zip
*.cab
\WINDOWS\inf\*.pnf
You can add additional files or directories that you intend to exclude during a capture operation.
For more information about configuration files, see Create an ImageX Configuration File.
2. Save the configuration file to the same location of ImageX as specified in step 3. For example,
Copy Code
c:\winpe_x86\mount\
ImageX will automatically detect Wimscript.ini only if it is saved to the same location.
Step 5: Configure BCD Store
In this step, you create a new boot configuration file called BCD by using BCDEdit. BCD replaces
Boot.ini. BCDEdit is a command-line tool designed to manage BCD stores. BCDEdit is available in
Windows PE and in Windows Vista. For example,
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 <GUID> with this value 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 –set <GUID> detecthal yes
Bcdedit /store c:\winpe_x86\mount\boot\BCD –displayorder <GUID> -addlast
Copy Code
oscdimg -n -m -o -bc:\winpe_x86\etfsboot.com c:\winpe_x86\mount
c:\winpe_x86\winpe_x86.iso
For IA-64 architecture, replace Etfsboot.com with Efisys.bin.
2. Burn the image (Winpe_x86.iso) onto a CD-ROM.
Note
If the hard drive contains an active partition, you must override the boot order to boot from the
CD/DVD drive. During initial boot, select the appropriate function key to override the boot order. If
this is a new computer, the hard drive will be unformatted, so you can skip this step.
2. At a command prompt, format the hard drive by using DiskPart. Windows PE requires an active
partition with a size equal to or greater than the size of your Windows PE image. For example,
Copy Code
diskpart
select disk 0
clean
create partition primary size=<insert size>
select partition 1
active
format fs=ntfs
exit
Copy Code
d:\imagex /apply d:\sources\boot.wim 1 c:
where d is the letter of your bootable Windows PE media that contains ImageX and a Windows PE
image.
2. Copy the \Boot folder from your bootable media to the root of your hard drive. For example,
Copy Code
xcopy d:\boot\*.* /e /f c:\boot\
3. Copy the Bootmgr file (no file name extension) from your bootable media to the root of your hard
drive. For example,
Copy Code
copy d:\bootmgr c:
4. Delete the boot configuration data (BCD) file that you copied from your bootable media. (You will
create a new one in the next step.) For example,
Copy Code
del c:\boot\bcd
Copy Code
Bcdedit –createstore c:\temp\BCD
Bcdedit –store c:\temp\BCD –create {bootmgr} /d “Boot Manager”
Bcdedit –store c:\temp\BCD –set {bootmgr} device boot
Bcdedit –store c:\temp\BCD –create /d “WINPE” –application osloader
Bcdedit –import c:\temp\BCD
The last command returns a GUID value. Substitute <GUID> with this value in the following examples.
Copy Code
Bcdedit –store c:\boot\BCD –set <GUID> osdevice partition=boot
Bcdedit –store c:\boot\BCD –set <GUID> device partition=boot
Bcdedit –store c:\boot\BCD –set <GUID> path \windows\system32\boot\winload.exe
Note
A Windows PE RAM disk boots directly into memory and is assigned the drive letter X, which
does not correspond to the media (for example, a UFD or a CD-ROM) from which you booted.
Ensure that you have sufficient memory to support the size of your Windows PE image plus
any additional memory requirements, for example, if you plan on running any customized
applications that need additional working memory.
Prerequisites
To complete this walkthrough, you need the following:
• A technician computer that provides all the tools and the source files. For more
information, see Building a Technician Computer.
Copy Code
copype.cmd <architecture> <destination>
where <architecture> can be x86, amd64, or ia64 and <destination> is a path to
the local directory. For example,
Copy Code
Copy Code
\winpe_x86
\winpe_x86\ISO
\winpe_x86\mount
Copy Code
imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount
Copy Code
peimg /install=<pkg> c:\winpe_x86\mount\Windows
where <pkg> denotes the package name. A list of available packages and their
names can be obtained by using the /list command. You can use wildcards to specify
a package name. Any packages with matching names will be installed. For example,
Copy Code
Copy Code
WinPE-FONTSupport-<region>-
Additional font support for ja-jp, ko-kr, zh-cn, zh-hk, and zh-tw.
Packages
Copy Code
peimg /list c:\winpe_x86\mount\Windows
In the INS column, (+) denotes installed packages and (-) denotes not installed.
Copy Code
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,
Copy Code
c:\winpe_x86\mount\Windows
Important
Adding files to the \Windows directory will increase the size of your Windows PE RAM
image. Ensure that your computer has sufficient memory to boot Windows PE and to
run various applications.
Copy Code
Copy Code
Copy Code
Next Step
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,
Copy Code
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.
Copy Code
diskpart
select disk 1
clean
create partition primary size=<size of device>
select partition 1
active
format fs=fat32
assign
exit
where the value of disk 1 is equal to UFD.
3. 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,
Copy Code
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.
Walkthrough: Create a Windows RE Image
This walkthrough describes how to build a Windows Recovery Environment (Windows RE) image.
Windows RE is a solution based on Windows PE 2.0. In this example, you create a customized
Windows RE image on your technician computer.
Important
This walkthrough outlines how to build the Windows RE solution, not a complete
Windows Vista image. You must still create a separate Windows Vista installation.
This walkthrough illustrates a hidden (type 0x27) Windows RE disk configuration. In the following
illustration, the Windows RE partition is located in front of the Windows Vista partition.
Windows RE-only (hidden)
There are other Windows RE disk configurations that coexist with Bitlocker Drive Encryption. For more
information on disk configurations, see Preinstallation Design.
Prerequisites
To complete this walkthrough, you will need the following:
• A technician computer that provides all the tools and the source files. For more
information, see Building a Technician Computer.
• An authorized copy of a Windows Vista product DVD.
Copy Code
copype.cmd <architecture> <destination>
where <architecture> can be x86, amd64, or ia64 and <destination> is a path to
the local directory. For example,
Copy Code
Copy Code
\winre_x86
\winre_x86\ISO
\winre_x86\mount
3. In this step, you mount a Windows PE image. For Windows OPK customers, you modify
the base Windows PE image (Winpe.wim). For Windows AIK customers, you modify the
default Windows RE image available from your Windows Vista product DVD.
Important
Windows AIK does not support the creation of a Windows RE solution by using the base
Windows PE image (Winpe.wim).
4. For Windows OPK, use the ImageX /apply option (or mountrw command) to mount
the base Windows PE image. For example,
5. Copy Code
6. imagex /apply c:\winre_x86\winpe.wim 1 c:\winre_x86\mount
7. For Windows AIK, copy and mount the Windows PE image from the Windows Vista
product DVD by using ImageX and skip Step 2. For example,
8. Copy Code
9. imagex.exe /export /boot <DVD_Drive>\sources\boot.wim 2 c:\winre_x86\winre.wim
“Windows Recovery Environment”
10.imagex.exe /mountrw c:\winre_x86\winre.wim 1 c:\winre_x86\mount
Copy Code
peimg.exe /install=WinPE-SRT* C:\winre_x86\mount\Windows
peimg.exe /install=WinPE-Scripting* C:\winre_x86\mount\Windows
peimg.exe /install=WinPE-WMI* C:\winre_x86\mount\Windows
2. Verify that the components were installed by using the peimg /list command to view
all packages in the current image. For example,
Copy Code
peimg /list c:\winre_x86\mount\Windows
In the INS column, (+) denotes installed packages and (-) denotes not installed.
Copy Code
[LaunchApp]
AppPath=X:\sources\recovery\recenv.exe
2. Copy the file to the \Windows\System32 directory in your working Windows PE
directory. For example,
Copy Code
copy winpeshl.ini C:\winre_x86\mount\Windows\System32
Copy Code
Copy Code
imagex.exe /capture c:\winre_x86\mount C:\winre_x86\winre.wim "Windows RE Image"
/boot /compress max
• For Windows AIK, in a Windows PE Tools Command Prompt window, commit your
customizations and unmount the image by using ImageX. For example,
Copy Code
imagex.exe /unmount /commit c:\winre_x86\mount
Walkthrough: Deploy a Windows RE Image on
Hard Drive
This walkthrough describes how to deploy a Windows Recovery Environment (Windows RE) image onto a
hard drive. Windows RE is a solution that is based on Windows PE 2.0. In this example, you build a master
computer that contains two partitions, one for Windows Vista and one for Windows RE. Once installed,
you configure Windows Vista Boot Manager to automatically failover to Windows RE when
Windows Vista is unable to boot.
Important
This walkthrough outlines how to build the Windows RE solution, not a complete
Windows Vista image. You must still create a separate Windows Vista installation.
This walkthrough illustrates a hidden (type 0x27) Windows RE disk configuration. In the following
illustration, the Windows RE partition is located in front of the Windows Vista partition.
Windows RE-only (hidden)
There are other Windows RE disk configurations that coexist with Bitlocker Drive Encryption. For more
information about disk configurations, see Preinstallation Design.
Prerequisites
To complete this walkthrough, you will need the following:
• A Windows RE image as described in Walkthrough: Create a Windows RE Image.
• A technician computer that provides all the tools and the source files. For more
information, see Building a Technician Computer.
• An authorized copy of Windows Vista.
• A USB flash drive (UFD). In this example, the storage size must be 256 megabytes
(MB) or bigger, depending on how many additional applications that you include in
your Windows RE image.
• A master computer on which you will deploy Windows Vista and Windows RE.
Note
A warning will appear that a catalog does not exist. Click OK to create a catalog. A
catalog file (.clg) is a local file that contains all the available settings.
Configuratio
Component
n Pass
Microsoft-Windows-
1 windowsPE
Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition
Microsoft-Windows-
1 windowsPE
Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition
Microsoft-Windows-Setup\ImageInstall\DataImage\InstallFrom 1 windowsPE
Microsoft-Windows-Setup\ImageInstall\DataImage\InstallTo 1 windowsPE
Note
Expand the component list until you see the lowest setting that is listed above, and
then add that setting to your answer file. This shortcut will add the setting and all
parent settings to your answer file in one step.
3. All the settings that you added must appear in the Answer File window. Select and
configure each setting as specified below.
Component Value
Microsoft-Windows-Setup\DiskConfiguration WillShowUI = OnError
DiskID = 0
Microsoft-Windows-Setup\DiskConfiguration\Disk WillWipeDisk = true
Extend = false
Order = 1
Size = 1500
Note
Microsoft-Windows-
Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition You can adjust size
accordingly; this example
uses 1.5 gigabytes (GB).
Type = Primary
Active = false
Extend = false
Microsoft-Windows-Setup Format = NTFS
\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition Label = WinRE
Order = 1
PartitionID = 1
Microsoft-Windows-Setup\ImageInstall\DataImage Order = 1
Path = <location of your
custom Windows RE image>
Microsoft-Windows-Setup\ImageInstall\DataImage\InstallFrom For example,
C:\winre_x86\winre.wim
DiskID = 0
PartitionID = 1
Note
4. Validate the answer file, click Tools, and then click Validate Answer File.
If an error occurs, correct the error and revalidate the answer file.
5. Save the answer file.
Component Configuration
Pass
Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\
1 windowsPE
CreatePartition
Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\
1 windowsPE
ModifyPartition
Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo 1 windowsPE
Microsoft-Windows-Setup\UserData 1 windowsPE
Microsoft-Windows-Shell-Setup\OOBE 7 oobeSystem
Microsoft-Windows-International-Core-WinPE\SetupUILanguage 1 windowsPE
Microsoft-Windows-Deployment\Reseal 7 oobeSystem
Microsoft-Windows-PnpSysprep 3 generalize
3. All the settings that you added must appear in the Answer File pane. Select and
configure each setting as specified below.
Component Value
Extend = false
Order = 2
Size = 15000
Note
Microsoft-Windows-
Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition You can adjust the Size
accordingly; this example
uses 15 GB.
Type = Primary
Active = true
Extend = false
Format = NTFS
Microsoft-Windows-Setup Label = OS_Install
\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition Letter = C
Order = 2
PartitionID = 2
4. Validate your answer. To do this, click Tools, and then click Validate Answer File.
If an error occurs, correct the error and revalidate.
5. Save your answer file.
Important
This feature creates an answer file (Autounattend.xml) and a resource folder
(\AutoUnattend_Files). In this example, both the file and the folder must be located at
the root of your UFD.
Copy Code
<WinREPartitionInfo>
<NotActive/>
<WinREHiddenPartition/>
</WinREPartitionInfo>
<NotActive> instructs Windows RE not to set the first partition to active in the event
you have multiple boot partitions. <WinREHiddenPartition> instructs Windows RE to
set the Windows RE partition as type 0x27 with no drive letter assigned. This method
does not support other hidden partition types.
2. By using your removable media, place a copy of the file at the root of each hidden or
customized partition.
Copy Code
copy c:\Program Files\<version>\recovery\setautofailover.cmd e:
where <version> can be Windows OPK or Windows AIK and e is the letter of the root
of your UFD.
Copy Code
e:\Windows\setautofailover.cmd /target d: /mainos {default} /disk 0 /partition 1
where e is the letter of the root of your UFD device. When you are finished, reseal and
shut down the computer. In the System Preparation Tool dialog box, select the
appropriate options.
For Extensible Firmware Interface (EFI) systems, you must configure use for GUID
Partition Table (GPT) disk. To configure for GPT, add the /gpt option. Here is an
example of this command.
Copy Code
Important
If you select the sysprep generalize option, the failover settings will be removed. To
generalize the image for build-to-plan (BTO) environments, run Setautofailover.cmd
during the oobeSystem pass. For example, copy the script to the root of the hard drive
and specify a RunsynchronousCommand during oobeSystem pass in your answer file.
To do this, select Insert, then Synchronous Command, and then Pass 7
oobesystem.
Configuratio
Component
n Pass
Microsoft-Windows-
1 windowsPE
Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition
Microsoft-Windows-
1 windowsPE
Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition
Microsoft-Windows-Setup\RunSynchronous\RunsynchronousCommand 1 windowsPE
Component Value
WillShowUI = OnError
Microsoft-Windows-Setup\DiskConfiguration
DiskID = 0
Microsoft-Windows-Setup\DiskConfiguration\Disk WillWipeDisk = true
Extend = false
Order = 1
Size = 1500
Note
Microsoft-Windows-
Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition You can adjust Size
accordingly. This example
uses 1.5 GB.
Type = Primary
Active = false
Extend = false
Microsoft-Windows-Setup Format = NTFS
\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition Label = WinRE
Order = 1
PartitionID = 1
Note
To set the automatic failover mechanism by using the /wim option, run the following command:
setautofailover.cmd /wim /target d: /mainos {default} /disk 0 /partition 1
The /wim option in Setautofailover.cmd configures the computer to use Winre.wim from the root directory
of the destination partition as the Windows RE image.
For Extensible Firmware Interface (EFI) systems, you must configure use for GUID Partition Table (GPT)
disk. To configure for GPT, add the /gpt option. For example,
setautofailover.cmd /wim /target d: /mainos {default} /disk 0 /partition 1 /gpt
Copy Code
copy c:\winre_x86\winre.wim c:\ISO\sources\boot.wim
Important
You must rename your Windows RE image to Boot.wim, otherwise the image will not boot.
Copy Code
peimg /inf=<path> c:\winpe_x86\mount\Windows
where <path> is the location of the .inf file.
3. Repeat steps 1 and 2 for each additional device driver.
When you finish customizing the image, prepare the image for deployment by using the peimg
/prep command.
After you prepare the image, you can burn the image to the designated media. First, recapture or commit
the local Windows PE directory into a .wim file by using ImageX, create an .iso file by using one of the
provided tools, and then burn the .iso file to the appropriate media.
Copy Code
[LaunchApp]
AppPath = %SYSTEMDRIVE%\myshell.exe
[LaunchApps]
%SYSTEMDRIVE%\mydir\application1.exe, -option1 -option2
application2.exe, -option1 -option2
Set the AppPath entry to the path to your shell application. The path can
either be fully qualified or
use environment variables, such as %SYSTEMROOT%\System32\Myshell.exe. The AppPath entry
does not support command-line options.
3. Save the file to %SYSTEMROOT%\System32 of your customized Windows PE image.
4. Recapture your Windows PE image as described in Walkthrough: Create a Custom Windows PE
Image.
Add a Customized Script with Startnet.cmd
You can add customized command-line scripts in Windows PE by using Startnet.cmd. By default,
Windows PE includes a Startnet.cmd script located at %SYSTEMROOT%\System32 of your customized
Windows PE image. Startnet.cmd currently starts Wpeinit.exe. Wpeinit.exe specifically installs Plug and
Play devices, processes Unattend.xml settings, and loads network resources.
1. Create a customized Windows PE image as described in Walkthrough: Create a Custom Windows
PE Image. During Step 4 of that process ("Add additional customizations"), use the following steps.
2. Edit Startnet.cmd to include your customized commands.
Note
For Plug and Play or networking support, ensure that you include a call to wpeinit in your
customized Startnet.cmd script.
3. Save your changes and recapture your Windows PE image as described in Walkthrough: Create a
Custom Windows PE Image.
Add Customizations with Unattend.xml
You can use an answer file with Windows PE to specify various settings and actions. When Windows PE
starts, it implicitly looks for a file called Unattend.xml at the root of any bootable device (for example, a
USB flash drive or a floppy disk). You can also specify an Unattend.xml file by using Startnet.cmd and
Wpeinit.exe.
To learn more about creating an answer file, see Building an Answer File.
To learn more about Wpeinit, see Wpeinit Command-Line Options and the previous section on using
Startnet.cmd.
Copy Code
imagex /apply WinPE.wim 1 c:\winpe_x86\mount\
-or-
Copy Code
imagex /mountrw WinPE.wim 1 c:\winpe_x86\mount\
2. Copy the necessary application files to your local Windows PE directory. For example,
C:\Winpe_x86\Tools to include the application on the bootable media or
C:\Winpe_x86\Mount\Windows\MyApp\.
3. Repeat the first two steps for each additional custom application.
4. To start the application automatically when Windows PE boots, you can create a startup script by
using a Winpeshl.ini file. For an example, see Include a Custom Script in a Windows PE Image.
5. If your application requires temporary storage, you can allocate additional memory using the peimg
/scratchspace command. Valid sizes include 32, 64, 128, 256, or 512 megabytes (MB). This
feature is only available offline. You cannot adjust this setting while a Windows PE session is
running.
Important
Make sure you have sufficient memory to load and run your custom Windows PE image. In addition
to the image size, you should have at least 256 MB of available working memory. If you have
limited memory, define a page file (Pagefile.sys) to improve memory management. For more
information on implementing a page file, see Wpeutil Command-Line Options.
6. When you finish customizing the image, prepare the image for deployment by using the peimg
/prep command.
After preparing the image, you can burn the image to media. First, recapture or commit the local
Windows PE directory to a .wim file by using ImageX, create an .iso file by using one of the provided
tools, and then burn the .iso file to the appropriate media.
For an example of how to build custom Windows PE images, see Windows PE Walkthroughs.
To add a package to a Windows PE image offline
1. Apply the base image (Winpe.wim) by using ImageX to a local Windows PE directory.
For example,
Copy Code
imagex /apply WinPE.wim 1 c:\winpe_x86\mount\
-OR-
Copy Code
Copy Code
Takeown /F c:\winpe_x86\* /R
Cacls c:\winpe_x86\* /T /G <user>:F
Rd /s /q c:\winpe_x86\
Where <user> is the name of your user account.
2. Add a package to the base image by using the peimg /install command. For
example,
Copy Code
peimg /install=<pkg> c:\winpe_x86\mount\Windows
where <pkg> denotes the package name. A list of available packages and their names
can be obtained by using the /list option. You can use wildcards to specify a package
name. Any packages with matching names will be installed. For example,
Copy Code
peimg /install=WinPE-HTA-Package c:\winpe_x86\mount\Windows.
-OR-
Copy Code
Copy Code
imagex /apply WinPE.wim 1 c:\winpe_x86\mount\
-OR-
Copy Code
imagex /mountrw WinPE.wim 1 c:\winpe_x86\mount\
2. Import the Windows PE language pack into your working directory. For example,
Copy Code
peimg /import=<path> c:\winpe_x86\mount\Windows
Where <path> is location of the language pack.
3. Once imported, install the language pack. For example,
Copy Code
peimg /install=<pkg> c:\winpe_x86\mount\Windows
Where <pkg> denotes the package name. A list of available packages and their names can be
obtained by using the /list option. If you add the /verbose option, the output will display the full
package name. Wildcards can be used when specifying a package name. Any packages with
matching names will be installed. For example,
Copy Code
peimg /install=*JA-JP* c:\winpe_x86\mount\Windows
Where wildcards denote any package with JA-JP in the package name.
4. Set the language by using the /lang option with the following syntax.
Copy Code
peimg /lang=<culture> <image path>
Where <culture> is the culture name property of the specified language. For example,
Copy Code
peimg /lang=JA-JP c:\winpe_x86\mount\Windows
When you finish customizing the image, prepare the image for deployment by using peimg /prep
command.
After preparing the image, you can burn the image to media. First, recapture or commit the local
Windows PE directory to a .wim file by using ImageX, create an .iso file by using one of the provided
tools, and then burn the .iso file to the appropriate media. Your Windows PE image will now boot into the
language that you specified.
Copy Code
imagex /apply WinPE.wim 1 c:\winpe_x86\mount\
-OR-
Copy Code
imagex /mountrw WinPE.wim 1 c:\winpe_x86\mount\
2. Add an update to the base image by using the peimg /import command. For example,
Copy Code
peimg /import=<path> c:\winpe_x86\mount\Windows
Where <path> is location of the update.
3. Determine the name of the update by using the peimg /list command. For example,
Copy Code
peimg /list
4. Add the update to the base image by using the peimg /install command. For example,
Copy Code
peimg /install=<updatename> c:\winpe_x86\mount\Windows
5. Repeat for each additional update.
When you finish customizing the image, prepare the image for deployment by using the peimg
/prep command.
After the image is prepared, you can burn the image to media. First, recapture or commit the local
Windows PE directory to a .wim by using ImageX, create an .iso file by using one of the provided tools,
and then burn the .iso file to the appropriate media.
Note
It is recommended that you recapture and save a copy of the image before running the /prep option. This
ensures that you have a custom base image that you can later modify. You can then reapply your custom
base image, run the /prep option to optimize for size, and then recapture the image to a new file.
For an example on how to build custom Windows PE images, see Windows PE Walkthroughs.
To prepare a Windows PE image for deployment
1. At a command prompt, run peimg /prep on your local Windows PE build directory. For example:
Copy Code
peimg /prep c:\winpe_x86\mount\Windows
2. After you prepare the image, you can burn the image to media. First, recapture or commit the local
Windows PE directory to a .wim file by using ImageX, create an .iso file by using one of the
provided tools, and then burn the .iso file to the appropriate media.
Note
This command will not work if you already prepared the image by using the peimg /prep command.
Copy Code
imagex /apply WinPE.wim 1 c:\winpe_x86\mount\
-OR-
Copy Code
imagex /mountrw WinPE.wim 1 c:\winpe_x86\mount\
2. Run the peimg /list command to view all packages in the current image. For example:
Copy Code
peimg /list c:\winpe_x86\mount\Windows
Important
Mounting an image in Windows PE is not supported.
If you add the /verbose option, the output will display the full package name. In the INS column, (+)
denotes installed packages and (-) denotes not installed.
Copy Code
\Sources\Recovery\Tools
2. Create an .xml file called WinREConfig.xml, with the following syntax.
Copy Code
<Recovery>
<Server/>
<RecoveryTools>
<RelativeFilePath> Tools.exe</RelativeFilePath>
</RecoveryTools>
<SupportTool AutoLaunch=”Yes”/”No”>
<RelativeFilePath> Tools.exe</RelativeFilePath>
</SupportTool>
<CustomFrontEnd>
<RelativeFilePath> Tools.exe</RelativeFilePath>
</CustomFrontEnd>
<AlwaysAuthenticate/>
<NonAdminToolsOnly/>
<StartupRepair>
<NoNetworking/>
<NoAutoLaunchFromCD/>
</StartupRepair>
</Recovery>
Choose the customizations that you intend to enable and include the corresponding
elements in your WinREConfig.xml file. The following table describes these XML
elements.
Element Description
Denotes customized support or the diagnostic tool that can be launched from a
SupportTool link when Startup Repair is unable to repair the operating system. Only one tool
can be specified.
Automatically launches the tool specified in SupportTool when the value is set
AutoLaunch equal to Yes. This setting does not apply to cases when no startup failure is
detected or a hardware error is detected.
The relative path from the \Tools subfolder of the folder in which Recenv.exe
RelativeFilePath resides. For example, if Recenv.exe is located in X:\WinRE\, the path
designated in this field is relative to X:\WinRE\tools.
NonAdminToolsOnl Only Startup Repair and the application specified in <RecoveryTools> (if
y present) is accessible through the Recovery menu. All other options are hidden.
StartupRepair Contains a list of Startup Repair-specific settings.
NoNetworking
Disables the sending of diagnostic and repair data to Microsoft. Startup Repair
will not turn on networking after a failed repair attempt.