HOW TO: inject drivers into Microsoft’s free OS, Windows PE 2.0

We’ve covered it before but it’s worth taking another look at the little-known version of Windows that is used to run the Windows Vista installation process: Windows PE 2.0.

It’s available as a standalone streamlined operating system which is incredibly helpful for all sorts of other things like system recovery and imaging.

It’s a highly stripped-back version of Vista that you can download free of charge as part of the Windows Automated Installation Kit (WAIK) — here’s an article we did last year on how to install and use it.

Since those earlier articles a couple of questions have sprung up about how to use the available tools to modify Windows PE-based boot images.

This is a pretty important issue because Windows PE is also used for the Windows Distribution System (WDS) Microsoft’s new software for deploying Vista across a large number of PCs via a network. Since WDS by its nature must work across various hardware platforms it probably needs more drivers than the smallish set that comes with it.

This can cause problems some of which I encountered in two different imaging scenarios – a virtual client loaded the boot image but I was told that there was no support for the network card (a definite problem for a network installation!) and another client with an nForce-based motherboard that simply bluescreened due to lack of appropriate system and SATA/IDE drivers.

Here’s how to get around the problem.

HOW TO: Inject Drivers into Windows PE 2.0

This tutorial assumes that you’re running Windows Deployment Services and want to update the default BOOT.WIM file to enhance platform compatibility but the processes for injecting extra drivers into a WIM file are exactly the same for ANY WIM-based image.

You’ll need a full install of the WAIK as it contains the necessary tools to manage WIM files. This can be done on any system but if you’re running WDS it will install properly on the WDS server. Insert the DVD and select “Windows AIK Setup†and install WAIK.

WAIK Install

Next you’ll need to create a folder to easily modify BOOT.WIM. I found it easiest to create a Temp folder and then two more folders within that called Mount and Drivers. Then copy BOOT.WIM from the Vista DVD to the TEMP folder and rename it CUSTOMBOOT.WIM.

Now download the drivers you need and extract them to TempDrivers.

You’re not after DOS drivers – remember that this is Windows PE 2.0 so XP drivers are the best ones to use (or Windows Vista if they’re available).

WinRAR is a great tool for extracting the contents of an EXE while maintaining the folder structure – this is very important as you need to be able to get at the INF driver files.

Once that’s done go to the Start Menu Microsoft Windows AIK Windows PE Tools Command Prompt. This loads a command window with the PE tools IMAGEX PEIMG and OSCDIMG loaded into the path which makes life much easier.

PE Tools Command Prompt

Navigate to Temp and type in:

imagex /info DRIVE:Tempcustomboot.wim

Where DRIVE is the appropriate drive letter. This checks the CUSTOMBOOT.WIM file and lists the images contained within it.

ImageX Info

There are actually two images but the one we want is the Longhorn Setup image – number 2. Now type in:

imagex /mountrw DRIVE:Tempcustomboot.wim 2 DRIVE:TempMount

This mounts image 2 of CUSTOMBOOT.WIM into the TempMount folder in read/write mode. You can navigate to this folder and browse the contents and make any changes you like.

PE Tools – Mount Image

Now go back to the command window and type in:

peimg /inf=DRIVE:TempDriverFOLDER*.inf /image=DRIVE:TempMount

Where FOLDER is the appropriate folder which contains the INF driver files. This injects the drivers straight into the mounted image. You can manually specify which driver is to be installed or just use the wildcard to install all the drivers found in that folder. Repeat this process for all the drivers you want to install.

PE Tools – Inject Drivers

Once that’s done type in:

imagex /unmount /commit DRIVE:TempMount

This unmounts the image from the TempMount folder and commits the changes you made. Do NOT forget the /commit statement or you’ll have to do the whole thing all over again. Not fun.

Now go back to the WDS console and right-click on the boot image then select Disable. Right-click again and select Replace Image then browse to TempCUSTOMBOOT.WIM. This will replace the contents of BOOT.WIM with the updated CUSTOMBOOT.WIM. It doesn’t erase BOOT.WIM and the boot image will still use the original file but the extra drivers are now loaded into the Longhorn Setup image. Being able to replace the image means that you can maintain an offline master boot image so you never need to directly work with the WDS boot image.

Unlike RIS where any such change required a restart of the service WDS accepts this change on the fly. Connect your clients to the WDS server and they will use the updated setup image with the incorporated drivers. In my setup both problematic platforms worked perfectly with the custom boot image.

Related articles