The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

Back to basic: Adding drivers to WinPE (or a normal image) in Offline mode

Posted by Mikael Nystrom on September 19, 2011

A couple of days ago someone asked me, –“Is this correct syntax for Imagex.exe and peimg.exe to inject drivers in WinPE”?

IMHO, Imagex and Peimg should not be used anymore; they belong to the “Generation-Vista”. Today we use other methods. Here is how you inject drivers in to a wim image, both a WinPE and a normal deployment image. So make sure you use WAIK for Windows 7 and WinPE 3.0

The following commands will mount an existing WinPE wim file first index. This is fine when you create your own WinPE, but if you are to use this Image in WDS you need to mount Index 2 and inject the drivers there. We also run two /Get-Drivers, this is an easy way to see the before and after, not really needed when you do it in a script.

dism /Mount-Wim /Wimfile:"c:\WinPEx64\winpe.wim" /MountDir:"C:\WinPEx64\mount" /Index:1
dism /Image:"C:\WinPEx64\mount" /Get-Drivers
dism /Image:"C:\WinPEx64\mount" /Add-Driver /Driver:"C:\USB3Driver\sp47527\Files\x64\nusb3drv.inf"
dism /Image:"C:\WinPEx64\mount" /Get-Drivers
dism /Unmount-Wim /MountDir:"C:\WinPEx64\mount” /Commit

If you need to add more then one driver, you can modify the script so it looks like this instead

dism /Mount-Wim /Wimfile:"c:\WinPEx64\winpe.wim" /MountDir:"C:\WinPEx64\mount" /Index:1
dism /Image:"C:\WinPEx64\mount" /Get-Drivers
dism /Image:"C:\WinPEx64\mount" /Add-Driver /Driver:C:\Drivers /recurse
dism /Image:"C:\WinPEx64\mount" /Get-Drivers
dism /Unmount-Wim /MountDir:"C:\WinPEx64\mount” /Commit

Just a quick note: It is possible to use WDS to inject drivers. If you have MDT and/or SCCM this “feature” is a part of those solutions.

/mike

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: