Driver Injection

When deploying Windows from a custom WinPE and the walkthrough-deploy.bat from Microsoft’s sample script (in the, you need to either;

  1. Create a model specific image, with device drivers built-in
  2. Manage driver injection, just in time, after Windows is installed on the hard drive, but while the PC is still booted in the WinPE environment

This page describes one possible solution for the 2nd of the two, where  you can deploy the Windows image, then dynamically lookup the device details from the firmware (the BIOS or UEFI) and load matching drivers to the device, just-in-time, at deployment time.

1st, you need to setup a share with drivers, sorted by device manufacturer, device model, and processor architecture.

Example; C:\Drivers\Microsoft Corporation\Virtual Machine\amd64

In the above example, the amd64 folder contains any drivers  for this device model, which are not natively supported by Windows. These drivers get used during driver injection when you deploy a generic image which includes no additional drivers. This way you can reduce the complexity by managing fewer deployment images.

Name the folder where you will save the INF based drivers after the values present in a reference device. For example, if you have a Dell Precision Workstation, lookup the Manufacturer value, the model value, and the operating system architecture (32 or 64 bit), and name the folders according to these firmware values.

Then you can run DISM with the /Add-driver option to add drivers, but instead of specifying the explicit path to a driver as you see in the DISM help files, use a variable based on the same device firmware lookup.

You can find the code embedded below from my GitHubGist or direct link here:

If you want to connect with me, I am on Twitter @Hal0san