Customizing Windows PE


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 root folder of the source files contains four files: Win51, Win51ip, Win51ip.sp1, and Winbom.ini. When you build a customized Windows PE CD, you must place these files at the root of the CD; otherwise, Windows PE will not start properly. For example, if Winbom.ini is missing, Windows PE hangs.

  • \Docs

    This folder contains the Windows PE documentation. In particular, “Windows Preinstallation Environment User's Guide,” which is Winpe.chm on the Windows PE CD in the Docs folder, contains reference information that this chapter doesn't.

  • \I386

    This folder contains the Windows system files. You can usually use these files when customizing a Windows PE CD rather than starting from scratch. If you want to start from scratch, however, you can rebuild the I386 folder.

  • \Winpe

    This folder contains scripts and other files necessary to build an I386 folder and customized Windows PE CDs.

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:

  • Diskpart.exe

    Diskpart is a text-mode command interpreter that enables you to manage objects (disks, partitions, or volumes) by using scripts or direct input from a command prompt. With Diskpart, you can create and remove volumes, assign drive letters, and so on.

  • Factory.exe

    Use Factory to update drivers, run Plug and Play enumeration, install applications, test, configure the computer with customer data, or make other configuration changes in your factory environment. For companies that use disk imaging (or cloning) software, efficient use of Factory can reduce the number of images that you require.

  • Mkimg.cmd

    This command builds the file set for Windows PE from any Windows XP or Windows Server 2003 product CD except Windows XP Home Edition and Windows Server 2003 Datacenter Edition. It optionally creates an ISO image of the files. You can then burn that ISO file to a CD by using any CD-burning software that supports ISO-9660. The CD image-creation process takes several minutes, and then the files are placed in the same location as where you run the Mkimg command.

  • Netcfg.exe

    The network configuration tool configures network access. When you preinstall Windows, it is most commonly used in a script that runs when Windows PE boots. You don't need to use this tool if you're starting the network with the command factory –winpe in Startnet.cmd, which is the default.

  • Oscdimg.exe

    This is a command-line tool that creates an ISO image file of a customized, 32-bit or 64-bit version of Windows PE. You can then burn that ISO image file to a CD.

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:

  • Windiff.exe from the Windows Support Tools

  • Depends.exe from the Windows Support Tools

  • File Monitor (FileMon from Sysinternals at http://www.sysinternals.com)

  • Registry Monitor (RegMon from Sysinternals at http://www.sysinternals.com)

Optional Components

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

  • ActiveX Data Objects

    ADO enables your client applications to access and manipulate data from a Microsoft SQL Server database through an OLE DB provider. Its primary benefits are ease of use, high speed, low memory overhead, and a small disk footprint. ADO supports key features for building client/server and Web-based applications. Windows PE doesn't support ADO access to Microsoft Access or Active Directory, however.

  • HTML Applications

    HTAs are full-fledged applications that are trusted and display only the menus, icons, toolbars, and title information that the Web developer creates. In short, HTAs pack all the power of Microsoft Internet Explorer'its object model, performance, rendering power, protocol support, and channel-download technology'without enforcing the strict security model and user interface of the browser. You can use the HTML and Dynamic HTML (DHTML) that you already know to create HTAs.

  • Windows Script Host

    WSH is a language-independent host that allows you to run any script engine on the Windows operating system. WSH is useful for scripting complex tasks that you can't easily do by using batch scripts.

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:

  • [MassStorageDrivers.Append]

    Specifies one or more third-party mass-storage drivers that a custom version of Windows PE loads in addition to the entire set of drivers that the Windows product CD supports. You copy the driver files to the %SystemRoot%\System32\Drivers folder and copy supporting files to the appropriate locations as specified in the driver's INF file.

  • [ MassStorageDrivers.Replace ]

    Specifies one or more third-party mass-storage drivers that a custom version of Windows PE loads instead of the entire set of drivers that the Windows product CD supports. You copy the driver files to the %SystemRoot%\System32\Drivers folder and copy supporting files to the appropriate locations as specified in the driver's INF file.

  • [ OEMDriverParams]

    Specifies non'Plug and Play drivers for Windows PE to load in addition to the drivers that Windows natively supports.

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.



Microsoft Windows Registry Guide
Microsoft Windows Registry Guide, Second Edition
ISBN: 0735622183
EAN: 2147483647
Year: 2003
Pages: 186

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net