Deploying Vista – Part 11: Working with Windows PE

by [Published on 16 Sept. 2008 / Last Updated on 16 Sept. 2008]

This series of articles on automating Windows Vista deployment continues by walking you through the steps of creating a bootable Windows PE CD.

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

In the previous article we examined the Windows Preinstallation Environment (Windows PE) and what it is, what it is not, and what it can do and be used for. In this article we’re going to create a customized, bootable CD containing Windows PE. Then in the next article we’ll show how to use this CD to boot a bare-metal system so we can install Windows Vista on it by connecting to a network share that has the Vista installation files stored on it - in other words, to perform an image-based deployment of Vista over the network.

To create our bootable Windows PE CD, we will need our Windows Vista with Service Pack 1 product DVD media. This is important as there are several versions of Windows PE out there. Specifically, there’s Windows PE 1.0 which was based on the Windows XP kernel; then there’s Windows PE which is based on the Windows Vista RTM kernel; and finally there’s Windows PE 2.1 which is based on the Windows Vista SP1 kernel which is also the same as the Windows Server 2008 kernel. So if you want to deploy both Windows Vista SP1 and Windows Server 2008, you need to use the latest version of Windows PE which is version 2.1, and this means you need a technician computer that has the version 1.1 of the Windows Automated Installation Kit (Windows AIK) installed on it. And finally, you’ll need a CD burner and third-party CD-burning software so you can burn your customized Windows PE .iso file onto CD-R media. Got everything? Let’s go!

Creating a Customized Windows PE 2.1 Boot CD

 Log onto your technician computer (I’m using a computer running Windows Server 2003 that has the Windows AIK installed on it) and click Start, All Programs, Microsoft Windows AIK, Windows PE Tools Command Prompt. As shown in Figure 1, this opens a Windows PE Tools Command Prompt window with C:\Program Files\Windows AIK\Tools\PETools as your current directory.


Figure 1: the Windows PE Tools Command Prompt on your technician computer

Type copype.cmd x86 C:\WinPE_x86 to run the copype.cmd command script which automatically creates a Windows PE build environment containing all the files needed for the 32-bit version of Windows PE:

C:\Program Files\Windows AIK\Tools\PETools>copype x86 C:\WinPE_x86

===================================================

Creating Windows PE customization working directory

    C:\WinPE_x86

===================================================

        1 file(s) copied.

        1 file(s) copied.

C:\Program Files\Windows AIK\Tools\PETools\x86\boot\bcd
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\boot.sdi
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\bootfix.bin
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\etfsboot.com
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\chs_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\cht_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\jpn_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\kor_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\wgl4_boot.ttf

9 File(s) copied

C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\bcd
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\chs_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\cht_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\jpn_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\kor_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\wgl4_boot.ttf

6 File(s) copied

        1 file(s) copied.

As shown in Figure 2, the copype.cmd script creates a new directory named C:\WinPE_x86 and this directory contains the files you will use shortly to create your Windows PE CD. The script also changes your current directory to your new build directory C:\WinPE_x86.


Figure 2: Windows PE build directory and files

If you explore this build directory, you will find various files and folders within. Table 1 provides a summary of the files and folders in this directory:

File or Folder

Description

\ISO

Contains the files needed to build an .iso file using Oscdimg.exe

\Mount

Use ImageX to mount the base Windows PE image to this folder when customizing your base Windows PE image

Etfsboot.com

A program that creates the CD boot sector

Winpe.wim

The base Windows PE image file

Table 1: Files and folders in the Windows PE build directory

Now let’s customize our Windows PE build environment by copying the ImageX.exe tool into it as we’ll need this tool later on for capturing an image of a master installation we wish to deploy. To copy ImageX.exe into our build environment, type copy “C:\Program Files\Windows AIK\Tools\x86\imagex.exe” C:\WinPE_x86\ISO\ at your Windows PE Tools Command Prompt:

C:\WinPE_x86>copy "C:\Program Files\Windows AIK\Tools\x86\imagex.exe" C:\WinPE_x86\ISO\

        1 file(s) copied.

Next we’ll use the Oscdimg.exe tool to create an .iso image from our Windows PE build files. To do this, change your current directory to C:\Program Files\Windows AI\Tools\x86 and then type oscdimg –n –bC:\WinPE_x86\etfsboot.com C:\WinPE_x86\ISO C:\WinPE_x86.iso at your command prompt like this:

C:\WinPE_x86>cd "C:\Program Files\Windows AIK\Tools\x86"
C:\Program Files\Windows AIK\Tools\x86>oscdimg -n -bC:\WinPE_x86\etfsboot.com C:\WinPE_x86\ISO C:\WinPE_x86.iso

OSCDIMG 2.54 CD-ROM and DVD-ROM Premastering Utility

Copyright (C) Microsoft, 1993-2007. All rights reserved.

Licensed only for producing Microsoft authorized content.

Scanning source tree

Scanning source tree complete (17 files in 8 directories)

Computing directory information complete

Image file is 210825216 bytes

Writing 17 files in 8 directories to C:\WinPE_x86.iso

100% complete

Final image file is 210825216 bytes

Done.

Once Oscdimg.exe has finished its work (it takes a few minutes) you’ll now have a bootable .iso file of your customized Windows PE build environment in the root of your system drive as shown in Figure 3:


Figure 3: Bootable .iso file of your Windows PE build environment

The final step is to use your CD burner and third-party CD-burning software to burn this .iso file onto recordable CD-R media. The simplest arrangement is to have a CD burner and software installed on your technician computer, but if you don’t then you can copy your WinPE_x86.iso file (it’s about 206 MB) onto a network share or removable media and transfer it to the computer you have your burner on.

Testing Your Windows PE CD

To test your Windows PE and see if it works, insert it into the CD-ROM drive of a computer and turn the computer on. If your computer doesn’t have any operating system installed on it, Windows PE will load and initialize and you’ll get the command prompt shown in Figure 4. If your computer already has an operating system installed, press a key when prompted to boot from CD in order to load and initialize Windows PE.


Figure 4: Windows PE has loaded and initialized

Examining Windows PE

Finally, let’s take a few minutes and examine the Windows PE environment we’ve just booted into. If you type hostname at the X:\> prompt, you should see that your Windows PE installation has a computer name  that begins with “minint-“ followed by some randomly-generated characters. If you type ipconfig you should see either a valid IP address obtained from a DHCP server (if there is one on your network) or an auto-generated IP address of the form 169.254.x.y. And if you type D:\imagex /? (or E:\imagex /? if your computer already has an operating system installed) you should see the syntax for using the ImageX command, which indicates that the ImageX tool is present on the Windows PE CD as intended. So far, so good.

What’s this X: drive stuff however? It’s called a RAM drive - that is, a disk volume contained in physical memory instead of on some physical device such as a hard drive. When you boot your computer using read-only bootable Windows PE media such as a CD, what happens is that Windows PE automatically creates a RAM drive and allocates 32 MB of space for this drive. This RAM disk is then used as a work area for any commands you run or any operations Windows PE needs to perform. Meanwhile, the Windows PE operating system itself is also loaded in its entirety into the physical memory of your computer, so this means once the X:\> prompt appears, you can eject your Windows PE CD and still be able to run commands like ipconfig and hostname and so on (though not imagex since that tool resides on the CD). This is handy in case you need to supply some additional drivers or scripts or something, as you can supply these files on a different CD which you can insert after you’ve removed your Windows PE CD.

Overall, Windows PE is pretty cool, and in the next article of this series you will see how to perform a simple, image-based deployment of Vista over the network by using your Windows PE CD as boot media for the bare-metal system you wish to install Vista on.

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

Featured Links