Adding Windows PE to Your Windows 7 System

Install a second “onboard emergency kit” OS on your hard disk—one built to be sleek and maintenance-focused

Mark Minasi

April 25, 2011

4 Min Read
ITPro Today logo in a gray background | ITPro Today

You’re on the road, and you go to turn on your Windows box, but instead of booting, it hangs or bluescreens. You have an idea how to fix it, but how do you get the thing started in the first place to attempt the repair? If only you had a second OS on the hard disk—one built to be sleek and maintenance-focused, sort of an “onboard emergency kit.” This month, I’ll show you how to install such a kit. It may not sound like it, but this is an important component of the SteadyState discussion I began last month in "Replicating SteadyState in Windows 7" (InstantDoc ID 129192).

In case you’ve never heard of Windows Preinstallation Environment (WinPE), Microsoft gives it away as part of the Windows Automated Installation Kit (AIK). WinPE’s purpose is solely as a sort of “starter OS” for maintenance, repair, and deployment. It’s essentially Window 7 with the Start menu, most of its built-in tools, and virtually all the GUI removed—but that's ideal for your emergency needs. Directions for setting up WinPE on a CD or a USB stick are easy to find, but you need it installed permanently on the hard disk, and accomplishing that is somewhat trickier.

I’ve figured out three different ways to put WinPE on a system. Two of those methods are so complex-looking that few people would use them, so I’m going to show you the simplest approach and save the truly ugly (but sadly sometimes necessary) ones for the future.

WinPE can’t reside on the same volume as Window 7, so in this scenario you’ll add WinPE to an already-working Windows 7 system in five steps: Install the AIK, shrink the C drive by a gigabyte, create a new volume in that gigabyte, use the AIK tools to image WinPE onto that partition, and use Bcdedit to create a new OS boot entry so that Windows gives us the option to boot to WinPE at boot time.

First, download the AIK for Windows 7 from the Microsoft Download Center (www.microsoft.com/downloads) and install it on your computer. (Yes, the AIK is big, but you can uninstall it when you’re done and get rid of all that stuff. Once you’ve downloaded the file—it’s an ISO file—burn it to a disk, run the startcd.exe file, and choose Windows AIK Setup.) Second, open Disk Management, right-click the C drive, choose Shrink volume, and shrink the C drive by 1,000MB. Once that’s done, you’ll have 1,000MB of unallocated space on your main drive. Right-click that, choose New simple volume, and let the wizard format the space and give it a drive letter. (I’ll use “W” in this example.) Now you’ve got a home for WinPE.

The AIK delivers two WinPE images—a 64-bit one and a 32-bit one. Both are named winpe.wim, so be sure to use the right one for your architecture. The 64-bit one is in C:Program FilesWindows AIKToolsPEToolsamd64winpe.wim, and the 32-bit one is in C:Program FilesWindows AIKToolsPEToolsx86winpe.wim. Click Start, All Programs, Microsoft Windows AIK, then shift-right-click Deployment Tools Command Prompt, choosing Run as Administrator and clicking Yes to the User Account Control (UAC) prompt if necessary. For example, I did this on my 64-bit system:

C:Program FilesWindows AIKToolsPETools>imagex /apply "C:Program FilesWindows AIKToolsPEToolsamd64winpe.wim" 1 w: /verify

While typing that, I cheated and shift-right-clicked on the winpe.wim file to put its entire path and filename in my clipboard so that I could paste it into that ImageX invocation. You should, too.

Finally, create a new OS entry so that your system will give you the option to boot WinPE from drive W. You’ll do this with essentially the same commands I examined in my boot-from-VHD discussions in past columns, so they should look familiar. First, you'll copy the current OS entry so that you’ve got a starting point:

bcdedit /copy \{default\} /d "Boot WinPE"

That returns a new, long GUID that you’ll need to enter into the following three commands:

bcdedit /set \{insert new guid\} device partition=w:bcdedit /set \{insert new guid\} osdevice partition=w:bcdedit /set \{insert new guid\} detecthal yes

Then, just add one new command that you haven't met before to set a new parameter winpe to yes, signaling to Windows that you’re booting a WinPE image:

bcdedit /set \{insert new guid\} winpe yes

Figure 1 shows my sample session. Reboot, and you’ll get the payoff: Boot Manager will contain a Boot WinPE option. Congrats! Your “emergency OS” is now installed, or at least installed one way. I'll show you another approach next month.


Figure 1


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like