The following sections are
intended to walk you through some common tasks. As a command line tool
with many options, even the most regular users will rely upon a
reference and some simple step-by-step instructions.
To prepare your system to employ the tasks
documented in this section, follow these steps:
Download the WAIK (approximately 1GB) from the Microsoft Web site (validation may be required).
www.microsoft.com/downloads/details.aspx?FamilyID=C7D4BC6D-
15F3-4284-9123-679830D629F2
After you have the download,
you will notice it has an IMG file extension. This is a DVD image file
which you may burn using your preferred software. It may be necessary to
rename the file extension from IMG to ISO in order for your software to
properly recognize the file. Alternatively, you can use a drive
emulator, such as Daemon Tools (www.daemon-tools.cc)
to mount the file as a drive without burning. Yet another option is to
make use of some tools like WinRar or 7zip, which support ISO files just
as you would any other archive file (like ZIP).
After you have downloaded and have access to the setup, run
STARTCD.EXE
for an installation menu, choose Windows AIK Setup, and follow the simple wizard through the installation.
Right-click
the Windows PE Tools Command Prompt shortcut from its program folder on
the Start menu and choose Run as administrator.
The many command line tools covered are typically executed from the
Windows PE Tools Command Prompt and must be run as administrator so this
is an important step.
To
establish the file structure needed to customize a Windows PE image,
run the CopyPE script with two arguments; the first is the target
architecture (x86, ia64 or amd64), and the second is the target
directory where you will manage your image.
If you are working with multiple architectures, it is a good idea to
include it in your target folder name. However, this is a path that
needs to be typed for most all commands so keep the path short to save
some typing. For the tasks documented in this section the following
arguments are used:
copype.cmd x86 c:\winpe_x86
Mount the Windows PE image for read/write updates:
imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount
1. Adding packages to a Windows PE image
There are a number of packages available in the default Windows PE image which you may optionally choose to have installed (see Table 1.).
Table 1. Default Packages Provided with Windows PE
Name | Description |
---|
WinPE-FontSupport-JA-JP-Package | additional Japanese font support |
WinPE-FontSupport-KO-KR-Package | additional Korean font support |
WinPE-FontSupport-ZH-CN-Package | additional Chinese font support |
WinPE-FontSupport-ZH-HK-Package | additional Hong Kong font support |
WinPE-FontSupport-ZH-TW-Package | additional Taiwanese font support |
WinPE-HTA-Package | HTML application (HTA) support |
WinPE-MDAC-Package | Microsoft Data Access Component (MDAC) support |
WinPE-Scripting-Package | Windows Script Host (WSH) support |
WinPE-WMI-Package | Windows Management Instrumentation (WMI) support |
WinPE-XML-Package | Microsoft SML (MSXML) parser support |
NOTE
There was a
package for the Windows System Recovery Tools (WinPE-SRT-Package)
available in earlier builds of Windows PE which was unfortunately
dropped. This has led many to exercise alternatives, such as BartPE for
this purpose, but workarounds are available online at www.vistaanswers.com/index.php/2008/03/31.
The following task covers how to install any of the packages provided in Windows PE by default:
List
the available packages to see what is available, what is currently
installed, and to verify the proper names for the available packages
using the PEImg List command:
PeImg /List c:\winpe_x86\mount
Any currently installed packages will be denoted with a plus (+) sign in the "Ins" column of the listed packages table.
Install the desired package by name, using wildcards if desired, with the WinPE Install command. For example, to install the Windows Script Host, you could use the following command:
PeImg /Install=WinPE-Scripting-Package c:\winpe_x86\mount
When done editing your image, be sure to commit the changes back to the mounted image by using the ImageX Unmount command:
Imagex /Unmount /Commit c:\winpe_x86\mount
2. Adding hotfixes to a Windows PE image
You may want to apply
service packs to your Windows PE image and this is something that is
supported by PEImg. After you download and extract the CAB file from the
update, you can use the import function to make it available as a
package in the image. Then you can simply install the package as you
would any of those included (detailed above).
Updates such as this are provided as MSU files. Extract the contents using the Expand command:
Expand c:\downloads\*.msu c:\updates -f:*
Run the PEImg Import to make the updates available as packages:
PeImg /Import=c:\updates\*.cab c:\winpe_x86\mount
List the packages to see the one you have added is now available as expected using the PEImg List command:
PeImg /List c:\winpe_x86\mount
Install
the new package by its name, or for updates you can specify the name
using a wildcard, such as *KB* that can perform the installation for any
packages with a name containing KB. For example:
PeImg /Install=Package_for_KB931213 c:\winpe_x86\mount
When done editing your image, be sure to commit the changes back to the mounted image using the ImageX Unmount command:
Imagex /Unmount /Commit c:\winpe_x86\mount
3. Adding drivers to a Windows PE image
Many of the most common
drivers are available in the default Windows PE image and will not
require any work on your part. However, there are those times when
devices, such as network devices will not function and getting the
latest driver in your image is the logical course of action.
One such driver is the
VMware network driver. VMware is used by many to test environments, such
as Windows PE, particularly because it is easy to provide it a bootable
image as an ISO file. To get network support from Windows PE from a
VMware session it is necessary to add the VMware network driver to your
image and use the PEImg INF command to perform the installation.
Start up a VMware session and choose the Install VMware Tools option.
Don't worry — if you already have them installed — doing this simply
mounts a VMware Tools installation CD (which may automatically start the
installation wizard). In the virtual CD that appears in your session,
go to E:\ProgramFiles\VMware\VMwareTools\Drivers\vmxnet\win2k\ and copy these files to your host system.
Copy D:\program files\VMware\VMware Tools\Drivers\vmxnet\
win2k\*.* \\server\drivers\network\vmware\
Install the driver using its INF file with the PEImg INF command:
peimg /inf=\\server\drivers\network\vmware\vmware-nic.inf c:\winpe_x86\mount\windows
When done editing your image, be sure to commit the changes back to the mounted image using the ImageX Unmount command:
Imagex /Unmount /Commit c:\winpe_x86\mount
4. Incorporating service packs
If you make use of Windows
PE 2.1, this release of Windows PE is based upon Windows Vista SP1.
Incorporating SP1 into a production Windows Vista image is not as simple
as you may have hoped. In the past, a practice known as slipstreaming
could be used to incorporate the service pack contents with the original
installation source. Apparently, there were plans to provide such a
deployment mechanism with SP1, but having run into problems it is now
hoped that such a feature will be seen with the release of Windows Vista
SP2.
The basic steps to include
Windows Vista SP1 to an existing Windows Vista production image are as
follows:
Boot to Windows PE and use ImageX to Apply image to reference PC.
Reboot, log in to the computer, and Install Vista SP1.
Run Sysprep with the generalize switch to prepare the image for deployment.
Reboot to Windows PE and recapture the image with the ImageX Capture command.
5. Editing the registry of a Windows PE image
Although you cannot work
with the registry as easily as you might hope, you can make changes to
the registry of your image. From within Windows, you need only mount the
image and then import the registry hive file into a temporary path in
RegEdit. After you have made any desired changes, you can export the
image path back to a file and replace the original file to realize the
changes with your image.
Depending upon which area of the registry you wish to edit, you will need to load the appropriate hive file (see Table 2).
Table 2. File Locations for Registry Hives
Registry Hive | Mounted File Location |
---|
HKLM\SOFTWARE | mount\windows\system32\config\SOFTWARE |
HKLM\SYSTEM | mount\windows\system32\config\SYSTEM |
HKEY_CLASSES_ROOT | mount\windows\system32\config\SOFTWARE (browse to classes) |
HKEY_USERS and HKEY_CURRENT_USER | Comprised of ntuser.dat files of your local user profiles (i.e., mount\Users\*\ntuser.dat) |
The steps to modify the registry of a WIM image are provided for your reference:
With the image mounted for read/write (/MountRW), run RegEdit and select the HKEY_LOCAL_MACHINE hive.
Choose File =>
Load Hive from the menu bar and browse to the location of the registry hive you want to modify (refer to
Table 6.10) from within the Windows PE mounted file structure
(c:\winpe_x86\mount\windows\system32\config\systemprofile\ntuser.dat)
Enter a temporary name for the hive, such as WINPE.
Browse to the WINPE node under HKLM and make any desired modifications.
When you are done making edits, click the WINPE folder under HKLM and choose File =>
Unload Hive. You will be prompted to confirm this action.
When done editing your image, be sure to commit the changes back to the mounted image using the ImageX Unmount command:
Imagex /Unmount /Commit c:\winpe_x86\mount
RegEdit
is also available in Windows PE so you can run this to verify your
results within Windows PE. However, changes made with RegEdit while
running Windows PE won't take effect because the registry is temporarily
loaded in memory.