PLAY NICE

# Injecting INF w/DISM

Author
Message
Topic Search   Topic Options

Joined: 16 May 2016
Status: Offline
Points: 48
Post Options    Thanks(0)    Quote  Reply Topic: Injecting INF w/DISM
Posted: 11 Dec 2017 at 1:49pm
Mount the Windows image

Open the Deployment Tools Command Prompt and type something like this to mount the image offline

Dism /Mount-Wim /WimFile:C:\My-Wims\ref-win7-image.wim /Index:1 /MountDir:C:\ wim-mount-dir

Apply the answer file to the mounted image using DISM

DISM /Image:C:\wim-mount-dir /Apply-Unattend:C:\unattend-answer-files\oflinedrivers.xml

Unmount the Windows Image

Dism /Unmount-Wim /MountDir:C:\wim-mount-dir /commit
Don’t forget the /commit switch otherwise changes to the image will not apply.

# Method 2: Using DISM to add individual INF files

This is a much easier method as it doesn’t involve the hassle of building answer files. Instead you issue DISM commands at the Deployment Tools Command Prompt to add inf files to an image.

Mount the Windows Image

At the Deployment Tools Command Prompt and type something like this to mount the image

Dism /Mount-Wim /WimFile:C:\My-Wims\ref-win7-image.wim /Index:1 /MountDir:C:\wim-mount-dir

Add an .INF Driver to an Image

Dism /Image:C:\wim-mount-dir /Add-Driver /Driver:C:\my-drivers\audio-driver.inf

Multiple drivers can be added by simply pointing to a folder which will install all .inf drivers found in that directory. To add drivers from subdirectories too use the /Resurse switch

Dism /Image:C:\wim-mount-dir /Add-Driver /Driver:C:\my-drivers /recurse

64-bit computers require drivers to have a digital signature (i.e. signed drivers). To get past this requirement use the /ForceUnsigned switch to install unsigned drivers

Dism /Image:C:\wim-mount-dir /Add-Driver /Driver:C:\my-drivers /ForceUnsigned

Unmount the Windows Image

Dism /Unmount-Wim /MountDir:C:\wim-mount-dir /commit
Again, without the /commit switch none of your changes will be saved to the image.

# Method 3: Copy device drivers to C:\Windows\INF\

During the Windows 7 installation process Setup searches for device drivers in the C:\Windows\INF\ directory including all subdirectories for devices on the computer and installs them as part of the same process ready to be used upon first log on.

I initially based my theory on the fact that all in-box and out of box drivers are stored in this directory so manually copying drivers here should allow Setup to find and install these drivers. I’ve found this to work absolutely fine in all my tests, including offline. (I’ve already mentioned how this works in Experiments with Sysprep and Preparing and Sysprep’ing the Reference Computer).

Here’s how this works in an offline scenario

Mount the Windows Image

At the Deployment Tools Command Prompt and type something like this to mount the image

Dism /Mount-Wim /WimFile:C:\My-Wims\ref-win7-image.wim /Index:1 /MountDir:C:\wim-mount-dir

Copy device drivers to C:\wim-mount-dir\Windows\INF\

Device drivers must be .inf files and not .exe applications. You might want to organise it in subfolders, for example

C:\Windows\INF\MyDrivers\audio64

C:\Windows\INF\MyDrivers\ethernet64

C:\Windows\INF\MyDrivers\chipset64

etc

Unmount the Windows Image

Dism /Unmount-Wim /MountDir:C:\wim-mount-dir /commit

When the .wim image is applied to a computer and turned on for the first time the device drivers will install as part of the Windows installation process, no problem.

Coming up next is Applying a Windows 7 image using ImageX.