Products History Gallery Manuals Download Links Arcade Forum Up&Runng Windows PC News
    Microsoft Windows Vista, 7, 2003, 2008, R2, XP and Exchange 2007 2010 processes and tips.  Includes Group Policy, Active Directory, Windows SharePoint Services, Outlook Shared Calendars, RAID5, McAfee and much more.  

How to Inject Drivers into Windows PE 3.0 .WIM in 5 Minutes
(or into a Windows 7 or 2008 R2 Image)

Prepared by Ian Matthews June 23, 2010

This is the followup to how to add drivers to a Windows PE 2.0 (Vista) .WIM file.  Today I needed to add a network driver to a Windows 7 PE 3.0 Boot Image I had in my Windows Deplopyement Services (WDS) 2008 Server.  After two hours of banging though half baked explainations a blogs I figured out the process. 

The nut of the problem is that the old Vista tools (WAIK and Deployment Workbench) have been updates with REQUIRED new tools.  Basically the PEIMG has been replaced with DISM.  In fact, as you will see, DISM will even do the work of IMAGEX.  In case you are wondering DISM stands for Deployment Image Servicing and Management tool... really great name... I suppose it would have made it too easy if they had just updated IMAGEX and PEIMG with new commands... but I digress.

The first thing you have to do is source the Deployment Workbench 2010 (yes, that is new and the old version with NOT work.  You can read/watch THIS if you have no idea how to get that started; the only thing to pay attention to is at the 1 minute mark in the video where it tells you how to source the WAIK (Windows Automated Installation Kit.)  Once you have this you are good to go.

  1. Get your .WIM file copied to your PC. file either:

    •  from the Windows 7 DVD (boot.wim or image.wim in the sources directory) or

    • pull it out of your WDS Server (if you have one, by right clicking on the image in question and selecting EXPORT)

  2. Create a folder called C:\TEMP.  Then create two subfolders; one called DRIVERS and the other called MOUNT

  3. Move your .WIM file to C:\TEMP\ and rename it CUSTOMBOOT.WIM

    • the rename is not required but I find it keeps everything straight in my head

  4. Download the drivers you need and put them in their own subfolder under C:\TEMP\DRIVERS (i.e. C:\TEMP\DRIVERS\ETHERNET\ and C:\TEMP\DRIVERS\SOUND\ ) . 

    • Don't put the driver .EXE file into that folder, you need to expand that .EXE and get the driver files out of it.

    • WinRAR and WinZIP work well for extracting .EXE files containing drivers.  For WinZip you simply drag the .EXE with the RIGHT MOUSE a few pixels and you will see WINZIP, EXTRACT TO... in the context menu.

    • Make sure you do not change the folder structure your driver .EXE file may have created. 

    • Use Windows 7, Vista (or at least WinXP drivers); DOS drivers will NOT work. 

  5. Click Start. Microsoft Windows AIK, Deployment Tools Command Prompt.

    • This will set a pile of software (i.e. DISM) in your "PATH" so you won't have to search for it.

  6. Dism.exe /mount-wim /wimfile:C:\temp\customboot.wim /index:2 /mountdir:C:\teMount (i.e. expand) CUSTOMBOOT.WIM with the following command:

    • Dism.exe /mount-wim /wimfile:C:\temp\customboot.wim /index:2 /mountdir:C:\temp\mount

    • NOTE: if you are working with a Win 7 image (i.e. not PE3.0) then change the number to from a 2 to a 1

  7. Inject your drivers using the following command:

    • dism /image:"C:\Temp\mount" /add-driver  /driver:"C:\temp\drivers\nic\rt64win7.inf"dism /image:"C:\Temp\mount" /add-driver  /driver:"C:\temp\drivers\network\re

    • be sure to replace the word "nic\rt64win7.inf" with the name and path to your driver.

      • Dism.exe /mount-wim /wimfile:"C:\temp\customboot.wim" /index:2 /mountdir:"C:  Error: 123 The filename, directory name, or volume label syntax is incorrect.You will receive the following error if you do not enter the correct path and I personally found that the command just did not like the quotations:
         Error: 123 The filename, directory name, or volume label syntax is incorrect.

  8. Dism /unmount-wim /Mountdir:C:\Temp\mount /commitCommit your update and recompress your updated image using the following command:

    • Dism /unmount-wim /Mountdir:C:\Temp\mount /commit

  9. Congratulations you are done!  If you want to push this to a Windows Deployment Services (WDS) Server read on.

  10. Start your WDS Console, right click on the boot image you wish to update, and select DISABLE

  11. Right Click on that same boot image and select REPLACE IMAGE.  The browse to wherever you have your CUSTOMBOOT.WIM and select it.

    • in my case I copied CUSTOMBOOT.WIM across the network from the VM I created it on to my W2003 WDS server prior to the REPLACE IMAGE STEP

    • this process will update the existing BOOT.WIM and REENABLE it.  There is no need restart services

    • You could delete your CUSTOMBOOT.WIM but I keep mine in case I want to add more drivers in the future.

I found THIS and THIS article to be useful, in case you have any other questions.