Lab 3: Add device drivers
Add device drivers to your images to support your hardware. Some have different installation procedures:
- .inf-style drivers: Many drivers include an information file (with an .inf extension) to help install the driver. These can be installed using tools described in this topic.
- .exe-style drivers: Drivers without an .inf file often must be installed like typical Windows desktop applications. We'll show you how to add those in Lab 10: Add desktop applications and settings with siloed provisioning packages (SPPs).
- Boot-critical drivers: Graphics and storage drivers may sometimes need to be added to the Windows image (as shown in this topic), as well as the Windows PE image (as shown earlier in Lab 1: Install Windows PE), and in the Windows recovery image. We'll show you how to update the recovery image later in Lab 12: Update the recovery image.
Prepare and mount the image
To make the changes to a Windows image, you'll mount the image contents into a temporary folder, and use tools like DISM to make the changes. Unmount the images to save the changes, and use your deployment scripts to test the images.
Step 1: Backup your Windows image file (recommended while testing new designs)
Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.
Make a backup of the image file:
copy "C:\Images\Win10_x64\sources\install.wim" C:\Images\install-backup.wim
Step 2: Mount the Windows image file
Create a temporary folder to mount the files, and mount the image into it:
md C:\mount\windows Dism /Mount-Image /ImageFile:"C:\Images\install.wim" /Index:1 /MountDir:"C:\mount\windows" /Optimize
Where /Index:1 refers to the image you want to mount. For the Windows 10 Home/Pro edition, use /Index:2 to select the Home edition.
This step can take several minutes.
Don’t mount images to protected folders, such as your User\Documents folder.
If DISM processes are interrupted, consider temporarily disconnecting from the public network and disabling virus protection.
If you've mounted an image to the folder before, try cleaning up the resources associated with the mounted image:
For some DISM commands, you'll need to make sure that you are using the Deployment and Imaging Tools Environment rather than the standard command prompt.
Add customizations to the image
These are just examples - you don't have to add all of these.
Step 3: Add drivers
Add a single driver that includes an .inf file:
Dism /Add-Driver /Image:"C:\mount\windows" /Driver:"C:\Drivers\PnP.Media.V1\media1.inf"
where "C:\Drivers\PnP.Media.V1\media1.inf" is the base .inf file in your driver package.
Troubleshooting: For many DISM commands, you can detailed information about the error by adding the /LogPath option. For example:
Dism /Add-Driver /Image:"C:\mount\windows" /Driver:"C:\Drivers\PnP.Media.V1\media1.inf" /LogPath=C:\mount\dism.log
Install a group of drivers by using the /Recurse option. This adds all drivers with a .inf file in that folder and all its subfolders.
Warning: While /Recurse can be handy, it's easy to bloat your image with it. Some driver packages include multiple .inf driver packages, which often share payload files from the same folder. During installation, each .inf driver package is expanded into a separate folder, each with a copy of the payload files. We've seen cases where a popular driver in a 900MB folder added 10GB to images when added with the /Recurse option.
Dism /Add-Driver /Image:"C:\mount\windows" /Driver:c:\drivers /Recurse
Verify that the drivers are part of the image:
Dism /Get-Drivers /Image:"C:\mount\windows"
Review the resulting list of packages and verify that the list contains the driver.
Unmount the image
Step 4: Unmount the images
Close all applications that might access files from the image.
Commit the changes and unmount the Windows image:
Dism /Unmount-Image /MountDir:"C:\mount\windows" /Commit
Try it out
Step 5: Apply the image to a new PC Use the steps from Lab 2: Deploy Windows using a script to copy the image to the storage USB drive, apply the image, and boot it up. The short version:
- Copy the image file to the storage drive.
- Boot the reference device to Windows PE using the Windows PE USB key.
- Find the drive letter of the storage drive (
diskpart, list volume, exit).
- Apply the image:
- Disconnect the drives, then reboot (
Step 6: Verify drivers
After the PC boots, either create a new user account, or else press Ctrl+Shift+F3 to reboot into the built-in administrator account (This is also known as audit mode).
Right-click the Start button, and select Command Prompt (Admin).
Verify that the drivers appear correctly:
Dism /Get-Drivers /Online
Review the resulting list of drivers. For example:
Deployment Image Servicing and Management tool Version: 10.0.14393.0 Image Version: 10.0.14393.0 Obtaining list of 3rd party drivers from the driver store... Driver packages listing: Published Name : oem0.inf Original File Name : contoso.graphicsdriver.inf Inbox : No Class Name : Graphics Provider Name : Contoso Date : 10/19/2016 Version : 10.0.0.1 The operation completed successfully.
- When creating several devices with the identical hardware configuration, you can speed up installation time and first boot-up time by maintaining driver configurations when capturing a Windows image.
Next step: Lab 4: Add languages