Windows DevCenter    
 Published on Windows DevCenter (http://www.windowsdevcenter.com/)
 See this if you're having trouble printing code examples


PC Deployment with WinPE

by Jim Aspinwall
03/20/2007

One of my many tasks as an IT professional is to figure out how to deploy Windows Vista to over 4,000 client PCs--some on a local LAN, some on WAN, some totally remote users connecting only by dial-up or DSL, and VPN. Deploying an operating system is no small feat--comprised of a lot of data, consuming a lot of time. Adding applications and configuration rules may include both basic deployment services--Business Desktop Deployment (BDD) with Windows Deployment Services (WDS)--and SMS, AD GPOs, or hands-on support.

Perhaps the most obvious choice for some systems is to provide a tool to back up users' data and simply reimage their PC. Reimaging is a pretty severe but often necessary solution and almost guarantees success versus doing an in-place upgrade, and it gives you a clean slate to work with. Reimaging over a LAN is quite effective. But for remote users, reimaging is typically next to impossible--moving 12GB or more over a WAN or broadband is painfully slow and failure prone.

There are a lot of ways to mitigate remote deployment issues with hidden partitions holding OS and application packages, backup DVDs, etc., but they all need an efficient and powerful way to make use of them. Windows Pre-Installation Environment (WinPE) is quite possibly the tool you need to work with Vista images, on a LAN, or local to the PC with CDs, DVDs, or external drives as the host medium for the image.

WinPE is Microsoft's answer to the cumbersome process of building just the right boot diskette, USB stick, or PXE boot environment, instead of struggling with DOS and a maze of drivers, or using third-party tools like BartPE (a staple in most techie toolbags). WinPE is also known as "MiniNT," and appears as merely a command-line interface within a faux-GUI setting. Behind it are all of the storage and networking device drivers and network services we fought to get running right on a bootable DOS diskette. Microsoft provides all of the tools and some of the instructions for leveraging WinPE and ImageX on bootable media, and with Windows Deployment Services (WDS) over a network PXE-boot architecture.

This article will show you how to get WinPE up and running with both the new WDS as well as its predecessor, Remote Installation Services (RIS), allowing you to deploy both Vista and legacy operating systems.

Prerequisites

WinPE is available only in the Windows Automated Installation Kit (WAIK). The full features of WAIK, which include ImageX, OS configuration, application packaging, and deployment management, are available when WAIK, the BDD, and WDS are installed on a Windows 2003 Server. If WAIK is installed on a server that is also running Microsoft's RIS, it can also support deployments of legacy operating systems, now redefined to include Windows XP as well as earlier operating systems. You can easily create a bootable WinPE USB FLASH drive by following the instructions listed below. For information on how to use ImageX for Vista, 2003, and XP images, see my upcoming companion article, "PC Deployment With ImageX."

Depending on your intended implementation plan, on one of your Windows 2003 servers to be used for RIS, WDS, WinPE and ImageX, you will have to install MSXML 6.x, .NET Framework, Windows Deployment Services, and WAIK, and provide specific DHCP services to get the full range of network boot and deployment capabilities. Installing RIS or WDS provides PXE boot services to WinPE. Having RIS available gives you the capability of deploying Windows XP or other client images in "legacy" mode in the same configuration you have Vista 32- and 64-bit deployment support.

Implementing WinPE

I use WinPE in all forms possible: PXE boot, USB drive, and CD-ROM bootable. PXE-booting WinPE is a lot more fun because no media is involved, but when network connectivity is challenged or PXE-boot is not supported in PC hardware, the USB "drive" is preferred because access to a network share with an image or access to a CD- or DVD-drive is right there. CD-ROM- or DVD-booting WinPE is necessary for distributing an image to connectivity-challenged remote sites and users. Of course WinPE is the means to use ImageX to capture, modify, and deploy WIM files, and no matter how WinPE is invoked, you can copy the ImageX tools to the boot media or access them over a network.

For routine use, PXE-booted WinPE needs something to work with, making WAIK and WDS logical choices to present Vista images for deployment; if RIS is installed when you set up WAIK, you have RIS's legacy OS distribution of XP as an added bonus. With WAIK and WDS, PXE-booting can bring you right to the deployment of Vista with ImageX.

WinPE Via WDS and PXE Boot

If you already have a Windows 2003 Service Pack 1 server installation with RIS, Windows Deployment Services is an add-on parallel to RIS, so you will be able to maintain legacy deployments with RIS and support Vista deployments. If RIS is not installed, WDS is all you will have available, and RIS cannot be installed after the fact. If you have RIS running on a Windows 2003 Service Pack 1 server and upgrade to Service Pack 2, RIS will be replaced by WDS. Because I want to migrate over to WinPE for legacy/XP deployments, staying at Service Pack 1 with both RIS and WDS is desirable until support for XP images is no longer necessary. I recommend a clean start with a fresh Windows 2003 Service Pack 1 server in a lab environment, off your production network. If this is the only server in your lab, include DHCP services for your test LAN segment. The DHCP scope on this server--or if you have Active Directory services including DHCP already running--needs to include the following settings:

060 PXEClient: PXEClient
066 Boot Server Host Name: <your PXE/WDS server name>
067 Bootfile Name: OSChooser\i386\startrom.com

These settings are picked up by your bare-metal/PXE-boot clients to start WinPE and the RIS or WDS imaging processes. You can have different PXE/WDS servers on each of your subnets if they have their own DHCP servers and the scope settings point to the respective PXE/WDS servers for each subnet.

Next, install RIS (via Add/Remove Programs→Windows Components), and your server is ready for the installation of BDD 2007, WAIK, and then WDS. The installations of BDD and WAIK are straightforward. You do not need to configure or use BDD's Deployment Workbench or WAIK's System Image Manager for basic image deployments. WDS under Administrative Tools is quite satisfactory to get a good start, and it will allow you to work with locally booted implementations of WinPE connected to your WDS server where the images are stored. WDS is one of the components to be installed via the WAIK setup program. After WDS is installed, restart the server and you're ready to begin setting up images for deployment.

If you're going to deploy XP or other legacy OS images through RIS you need to capture them with ImageX. (This will be covered in a related article, "PC Deployment With ImageX.") You'll need WinPE and ImageX setup on bootable media (covered in the next sections of this article), and a place to store the image, which can be a mapped network drive, courtesy of WinPE.

Go to Administrative Tools and select Windows Deployment Service to open its MMC. Right-click Servers, then add your WDS server(s) to the WDS MMC Server branch. Establishing a server creates empty entries for Install Images, Boot Images, Legacy Images, and Pending Devices. The Pending Devices branch is used only if you set up the WDS server properties and PXE Response to require that each PXE-booted client get approval before having access to WDS images.

To begin PXE-booted WinPE-based deployments, you need to include the appropriate boot images for x86, ia64, and AMD64 platforms. Right-click the Boot Images branch, select Add Boot Image, and then browse to the location of your WinPE images, typically C:\Program Files\Windows AIK\PETools, and the appropriate folder for the desired boot platform. Then select the WinPE.WIM file. Next, review the name and description of the WinPE image (you may want to create different versions to include other tools and features later on) and review the summary of the image you are adding. Then WDS adds or builds the image, and it's ready to go.

The process for adding a legacy or Vista image is similar. Legacy images must be captured separately. For Vista, right-click the Install Images branch. Then I suggest you create Image Groups to organize various builds of your OS deployment--say, Generic, Sales, Marketing, Engineering, etc. Once you've created a group, right-click the group name, select Add Install image, and then browse to the INSTALL.WIM file on your Vista DVD. The process of copying/building a WDS-deployable Vista image takes about 15 to 20 minutes. Once this build and WinPE build is complete, deploying Vista is about...let's see, power button, F12, F12, [Enter]...four taps and 20 minutes away from placing Vista images on your client PCs. Customizing those images and deploying applications to them is another matter entirely.

WinPE on a CD

The WAIK provides tools necessary to make a WinPE bootable ISO file that can be applied to CDs and DVDs in a few simple steps:

  1. On a PC running Vista with WAIK installed, make an empty folder as the destination for the files to be built into the resulting ISO file for burning.
  2. In a command-prompt window, issue the following commands:
  3. cd \program files\Windows AIK\Tools\PETools
    
    copype <architecture> <dest.folder>
    <architecture> would be x86, ia64, or AMD64, the versions of WinPE and deployment support tools you want to work with from your CD or DVD.
  4. Copy any and all tools you want available into the destination folder. All architecture versions of ImageX are a good starting place.
  5. Create a configuration text file, wimscript.ini, in the folder(s) used to hold ImageX.exe, with the following entries:
  6. [ExclusionList]
    ntfs.log
    hiberfil.sys
    pagefile.sys
    "System Volume Information"
    recycler
    windows\csc
    
    [CompressionExclusionList]
    *.mp3
    *.zip
    *.cab
    \windows\inf\*.pnf
  7. Create your ISO image file, at the command-line, from the PETools folder:
  8. Oscdimg -n -b c:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso
  9. Write the ISO file to your choice of media.

WinPE on a USB Flash Disk

The first thing you will need is a USB drive with 512MB or more of storage capacity (WinPE takes about 350MB of space.) The USB drive will be overwritten. You will also need WAIK installed on a Windows Vista client or 2003 server. There are more than a few steps to follow:

  1. Format the USB drive. At a command prompt, execute the following commands:
    1. diskpart - this will show the known drives on your PC. Make note of the drive number representing your USB drive.
    2. select disk <#> where # is the USB drive discovered above.
    3. clean
    4. create partition primary
    5. select partition 1
    6. active
    7. format fs=fat32
    8. assign
    9. exit
  2. Go to the Start menu. Select "Windows PE Tools Command Prompt" from under the Windows AIK program folder. Run:
  3.    copype.cmd x86 c:\<winpe_folder>
  4. Copy versions of ImageX, GHOST, or any tools you want to <drive>:\<winpe_folder>\iso
  5. Create and store a wimscript.ini as in Step 4 above.
  6. Run the following command to copy WinPE to your bootable USB drive:
  7.     xcopy <drive>:\<winpe folder>\iso\*.* /s /e /f <drive>:\

Conclusion

With WinPE you have the foundation for a very powerful bootable toolkit--network access, drive mapping, and typically, imaging capture and deploy. I'm looking for more ways to make good use of all WinPE has to offer. Suggestions?

Microsoft's comprehensive reference to Windows Deployment Services can be found here. Click the "Windows Vista: Deployment" link.

Jim Aspinwall has been the Windows Helpdesk columnist and feature editor for CNET.com and is the author of three books on PC maintenance.


Return to the Windows DevCenter.

Copyright © 2009 O'Reilly Media, Inc.