Microsoft Windows Registry Guide, Second Edition

Customizing Windows PE

The uncustomized version of Windows PE is useful for preparing computers for installation, but you don't realize its full power until you customize it. You can add your own 32-bit command-line tools, scripts, optional components, and so on. To do that, you need the Windows PE source files and, possibly but not always, a Windows product CD, both of which must have matching build numbers. You also need access to any command-line tools, scripts, and device drivers that you want to add to Windows PE. The Windows PE source files you received from Microsoft contain the following folders:

The first step in customizing Windows PE is simply to copy the Windows PE source files to your hard disk. If you received Windows PE on a CD, copy them from the CD. If you downloaded the files from Microsoft, keep the original files intact by making another copy. Make sure you copy the root folder that contains Win51, Win51ip, sp1, and Winbom.ini, as well as the three subfolders, Docs, I386, and Winpe. If you want to, you can rebuild the I386 folder using the following steps:

  1. Delete the existing I386 folder.

  2. Turn off the read-only attribute of all files in the Winpe folder.

    The scripts in the Winpe folder overwrite certain files and can't do so with the read-only attribute set on those files.

  3. Put the Windows product CD in the CD-ROM drive, or make sure that a folder containing the Windows source files is available on your local hard disk or on the network.

    If the files are on the network, map a drive to the share containing them, because it simplifies the command line.

  4. Run the command mkimg.cmd source destination source destination [ [ isoimage]]isoimage]] in the folder containing the Windows PE tools.

    • Source is the path of the Windows product CD or the folder containing the I386 folder. Don't use a trailing slash (\). C:\Winxp is good, but C:\Winxp\ is bad.

    • Destination is the folder in which Mkimg.cmd will create the custom version of Windows PE. Mkimg.cmd will create this folder if it doesn't already exist.

    • Isoimage is the path and file name of the International Organization for Standardization (ISO) image you want to create. You typically will not use isoimage because you want to create the ISO image after you've made other customizations. For example, if the Windows PE source files are in C:\MyWinpe, and the Windows CD is in drive D, run the command mkimg D: C:\MyWinpe\I386

The process completes after several minutes. The result is the Windows PE files in the destination directory and optionally an ISO image that you can burn to a CD. If you're using Windows PE from RIS or from a hard disk image, you probably don't care about the ISO image. Keep in mind that you should wait to create the ISO image if you have additional customizations you want to make.

NOTE

You can create a custom version of Windows PE from any version of Windows XP or Windows Server 2003 except for Windows XP Home Edition or Windows Datacenter Server 2003.

The size of the 32-bit Windows PE image is about 120 megabytes (MB). Your customizations will use additional space. Adding languages to the image also uses additional space. Regardless, there is usually enough room to copy the Windows source files to the Windows PE CD so that you can more fully automate the Windows installation process for users or technicians. If the Windows source files don't fit on the CD with your custom version of Windows PE, you can reduce the size of Windows PE considerably.

More Info

“Windows Preinstallation Environment User's Guide,” which you find on the Windows PE CD in the file Winpe.chm, describes which files you can remove to reduce the size of Windows PE.

TIP

To configure Windows PE so that it starts from the CD every time without requiring the user to press a key, remove the file bootfix.bin from the I386 folder of the Windows PE directory structure before you create an ISO image. Bootfix.bin provides the “Press any key to boot from CD-ROM” message.

Command-Line Tools

The following command-line tools are available when preinstalling an operating system or using Windows PE:

More Info

See “Windows Preinstallation Environment User's Guide,” which is Winpe.chm on the Windows PE CD in the Docs folder, for more information about these tools. Winpe.chm includes detailed documentation for each command-line option that these tools support. You find examples of using these tools in this chapter.

There are additional tools that would be useful to add to your Windows PE image, including the scripts that you create to automate redundant processes such as partitioning and formatting disks. You can place them anywhere within your Windows PE CD, but I recommend a subfolder in the I386 folder so that the tools will be available if you install Windows PE from a RIS server. Also, the following list describes tools that I like to include in a Windows PE image for installation preparation:

Optional Components

You can add the following components to a customized Windows PE image:

TIP

If you intend to automate installations, you almost always want to include WSH and HTA in Windows PE. Size isn't a concern if you're installing Windows from the network.

BuildOptionalComponents.vbs is the script you use to add support for optional component packages. This script is in the Windows PE Winpe folder. If you run this script without any command-line options, it creates a folder containing all the optional components. If you run this script with specific command-line options, the folder that it creates contains only those components. After the script finishes, you simply copy the folder that it creates over the I386 folder for your Windows PE image. The following line of code describes the syntax of BuildOptionalComponents.vbs, and Table 16-1 describes each command-line option:

BuildOptionalComponents [/S:location] [/D:location] /ADO /HTA /WSH /64 /Q /E

Table 16-1 BuildOptionalComponents.vbs Command-Line Options

/S:location

Specifies the source location of the Windows source files

/D:location

Specifies the destination location for the component files

/ADO

Specifies to build ADO for SQL Server connectivity

/HTA

Specifies to build HTA

/WSH

Specifies to build WSH

/64

Specifies to build and check 64-bit version of Windows PE (requires Windows XP 64-Bit Edition)

/Q

Runs the script without prompting for inputs; returns any errors

/E

Explores the resulting folder automatically when complete

After you add optional components to Windows PE, customize Startnet.cmd to install them when Windows PE starts. BuildOptionalComponents.vbs creates the batch script oc.bat in %SystemRoot%\System32, which installs the optional components. Call this batch script from Startnet.cmd, as shown in Listing 16-1.

Network Drivers

Although Windows PE supports network and mass-storage drivers, other types of device drivers don't function in Windows PE. Even if they appear to function, they're likely to be missing key dependencies that prevent them from working properly.

Windows PE supports all the network drivers included on the Windows product CD. When customizing a Windows PE image, you can add, remove, or replace network drivers as necessary. For example, you can remove unnecessary network drivers to reduce the size of the image and the time required to boot. After completing the following three steps, executing the Factory command in Startnet.cmd automatically identifies the network drivers that you add:

  1. Copy the driver's INF files to %SystemRoot%\Inf (the matching catalog file isn't necessary).

  2. Copy the driver's SYS files to %SystemRoot%\System32\drivers.

  3. Copy related DLL, EXE, or other files to %SystemRoot%\system32.

In addition to adding, removing, and replacing network drivers, you can limit the number of network adapters that the factory command scans by using the [netcards] section of the Winbom.ini file. When this command runs from the Startnet.cmd batch file, it scans only for the network adapters in this section, resulting in a faster boot time. To add network adapters to this section, you must know the adapter's Plug and Play ID and the path of its INF file. The following example shows the values necessary to specify the adapter's specific Plug and Play ID as well as its more generic ID, which ensures that it matches any network adapter supported by the driver:

[NetCards] PCI\VEN_10B7&DEV_9200&SUBSYS_100010B7&REV_78\3&61AAA01&0&78=%systemroot%\ nic\netel90b.inf PCI\VEN_10B7&DEV_9200&SUBSYS_100010B7=%systemroot%\nic\netel90b.inf

Mass-Storage Drivers

Configuring a limited set of mass-storage drivers can reduce the boot time of Windows PE. Instead of loading the entire set of mass-storage drivers that the Windows product CD natively supports, Windows PE just loads the drivers that you specify in the Winpeoem.sif file, which is in %SystemRoot%\System32. You can also configure this file to support additional mass-storage drivers that the Windows product CD doesn't natively support. The Winpeoem.sif file has the following three sections for controlling mass-storage drivers:

More Info

See “Windows Preinstallation Environment User's Guide,” which is Winpe.chm in the Docs folder on the Windows PE CD, for detailed instructions about using this section.

NOTE

Similar to booting to a Windows CD, the F6 option to add mass-storage drivers still works when starting Windows PE.

Languages

Windows PE doesn't support multilanguage builds'only individual-language localized builds. Still, you can build Windows PE images in various languages without needing localized Windows PE tools for each language. In other words, you can use a single set of tools to build multiple localized Windows PE images.

You use the [RegionalSettings] section in the Config.inf file to add support for multiple languages. You must always match the Language value to the language of the Windows product CD that you're using to build the Windows PE image. Then you use the LanguageGroup value to specify the languages of both the Windows PE tools and the Windows product CD. For a list of the specific languages that correspond to particular language groups, see the Microsoft Global Software Development Web site at http://www.microsoft.com/globaldev/default.mspx.

For example, to create a Japanese Windows PE image by using a Japanese Windows product CD, set LanguageGroup=1,7 and Language=0x0411 in the [RegionalSettings] section of Config.inf. The language group ID for Western Europe and United States is 1, and 7 is the language group ID for Japanese. The local ID (LCID) for Japanese is 0x0411, which matches the local of the Windows product CD. Adding 1 to the LanguageGroup value ensures that you can use the English preinstallation tools.

Категории