Deploying Vista – Part 10: Understanding the Windows Preinstallation Environment

by [Published on 28 Aug. 2008 / Last Updated on 28 Aug. 2008]

This series of articles on automating Windows Vista deployment continues by examining the Windows Preinstallation environment and its role in deployment scenarios.

If you missed the previous articles in this series, please read:

Let’s briefly recap what we have learned so far in this series of articles on deploying Vista. We began by examining the Windows Automated Installation Kit or Windows AIK. Then we looked at how Windows Setup works, focusing especially on understanding the seven different configuration passes of Setup. After that, we moved on to take a birds-eye view of different scenarios for deployment and how the Sysprep tool makes these scenarios possible. After this we introduced Windows System Image Manager or Windows SIM, a key tool you use to create answer files for automating the installation process. The three articles that followed then walked you through the process of creating a basic answer file that automates the Setup process including Windows Welcome, and which you can use to perform a completely unattended install of Vista using your product DVD together with a USB flash drive containing your answer file.

The unattended install from DVD method (sometimes called the boot from DVD method) is fine if you have only a few computers to install, but what if you have dozens of computers and you want to install them in one shot instead of one after another? Aha, now we’re moving into something different - deployment over a network - and we’ll need additional tools to make this work. The first new tool we’re going to need is called the Windows Preinstallation Environment or Windows PE, and that’s what we’ll begin looking at in this article. Then once we’re familiar with WinPE and how we can use it to perform network installs of Vista, we’ll learn how to use Windows Deployment Services to make our network installs even simpler.

What is Windows PE?

Basically, Windows PE is a minimal version of Windows you can use to boot a bare-metal system (a computer with no operating system installed) and then connect to a network share, download the installation files for the full version of Windows, launch Setup.exe, and install Windows on the computer. Why do we need Windows PE to do this? Well, it’s simple: you’ve got a file server over there with a shared folder on it that contains the Windows installation files, and you’ve got a bare-metal system over here with no operating system on it, and you’ve got them both connected to the network, so you turn on your bare-metal system and…well, how is a computer with no operating system on it supposed to be able to connect to a shared folder over the network and launch Setup.exe from that folder?

In the old days, we used a network boot floppy to make this happen. This was a bootable floppy disk from which you could run a network-aware version of MS-DOS, and to install, say, Windows 95, you would stick the floppy in your bare-metal system, turn the computer on, boot to DOS, and then manually (or automatically by launching a script) connect to the installation share on the network and run Setup.exe to begin the process of downloading the Windows installation files to the computer and running Setup on it to install Windows. Unfortunately, network boot floppies are no longer viable for a variety of reasons including lack of support for the NTFS file system, lack of support for 32- or 64-bit Windows device drivers, limited TCP/IP networking capabilities, and other reasons. What worked fine for installing Windows 95 or Windows 98 onto computers just doesn’t cut it anymore with Windows Vista.

By contrast, using the Windows AIK you can now create Windows PE boot media that supports NTFS, supports 32- and 64-bit Windows drivers, has full TCP/IP capabilities and which can be booted from a CD, a DVD, or even a USB flash drive. Then once you have booted your bare-metal system, you can manually (or automatically by using a script) connect to a network share that has the Windows Vista installation files stored on it and launch Setup.exe to install Vista onto the computer in completely unattended fashion using an answer file you created using Windows SIM.

Limitations of Windows PE

This doesn’t mean Windows PE can do everything however. For example, while Windows PE is a stripped-down version of the Windows operating system and provides you with a command prompt and can do networking and has a registry and so on, you can’t use it as your daily operating system for the simple reason that it automatically stops working and automatically after 72 hours of use. Windows PE also doesn’t support installing applications that use Windows Installer (.msi) files, and it doesn’t include the .NET Framework or the Common Language Runtime (CLR), so you really can’t run any office productivity applications on it. Windows PE also supports only a limited subset of the full Win32 application programming interfaces (APIs) so you really can’t develop useful applications to run on it either. So while Window PE is indeed Windows itself, it’s a very stripped-down version of Windows, not the full-blown version you’re used to working with each day.

All these limitations mean that Windows PE is really only useful for two things: to boot bare-metal systems so you can install Windows on them, and to boot into the Windows Recover Environment (WinRE) in order to troubleshoot a computer that has problems with its Windows installation. Actaully, Windows PE is used for one additional thing: each time you install Windows Vista (or Windows Server 2008) on a system, the very first phase of Setup is actually Windows PE at work.

Examining Windows PE Tools

As you can see from Figure 1 below, when Windows PE initializes it displays a command prompt.


Figure 1: The Windows PE command prompt

This command prompt is the only user-interface that Windows PE provides—there is no desktop and no GUI tools in Windows PE. There are a number of command-line tools available in Windows PE however, and these include the following:

This tool can be used to edit the boot configuration data (BCD) store, a store that describes boot applications and boot application settings. The BCD store in Windows Vista and Windows Server 2003 replaces the Boot.ini used by earlier versions of Windows.

Bootsect - Used to restore your computer’s boot sector (replaces FixFAT and FixNTFS used by previous versions of Windows)

DiskPart – Used to create and format partitions and volumes and perform other disk management tasks.

Drvload - Used for adding out-of-box drivers to a booted Windows PE image.

Oscdimg -  Used for creating an .iso image of Windows PE so you can burn the operating system onto CD or DVD media to create a customized, bootable Windows PE CD or DVD.

PEImg - Used to create or modify a Windows PE image by adding drivers, importing packages, and so on.

In addition to the above tools there are others that are built into Windows PE. Plus you can add additional command-line tools to your customized Windows PE CD or DVD. For example, in the next article of this series we’ll walk through the steps of creating a bootable Windows PE CD that includes the ImageX.exe tool on it, and later on I’ll show you how you can use this tool on a Windows PE CD to capture an image of a sysprepped master computer so you can deploy the captured image onto bare-metal destination computers—a deployment scenario called image-based deployment that is popular with OEMs and large enterprises. But that is for next time.

If you missed the previous articles in this series, please read:

Featured Links