Home > Sample chapters

Configure devices and device drivers

Skill: Use Deployment Image Servicing And Management tool to add packages

You saw earlier that the Deployment Image Servicing and Management (DISM) tool is now included as part of the Windows 10 operating system. It is useful for offline image servicing. DISM is a command-line tool that you can use to maintain images and apply them with Windows Updates. It is also used to add and remove Windows features, including language packs, and to manage device drivers.

Add packages using DISM

If you have a custom Windows 10 image, you can use DISM to modify it, and the changes will be visible when you next deploy the image. This can be useful when you know that a driver has been updated since you built the deployment image. Using DISM to inject the new driver saves you from having to rebuild the whole image. Using DISM is similar to using a file compression tool such as WinRAR, whereby you add or remove new files and then WinRAR reseals the .wim, .vhd, or vhdx file ready for deployment.

When you use DISM to install a device driver to an offline image, the device driver is added to the driver store. When the image is booted, Plug And Play (PnP) runs, looks for drivers in the store, and associates them with the corresponding devices on the computer they’re being installed on.

To add drivers to an offline image by using DISM, use these steps.

  1. Right-click the Start button and select Command Prompt (Admin).

  2. Establish the name or index number for the image that you are servicing by typing:

    Dism /Get-ImageInfo /ImageFile:C:\test\images\install.wim
  3. Mount the offline Windows image by typing the following.

    Dism /Mount-Image /ImageFile:C:\test\images\install.wim /Name:"Windows Offline
    Image" /MountDir:C:\test\offline
  4. You can now add the driver, located in the C:\Drivers folder, to the image by typing:

    Dism /Image:C:\test\offline /Add-Driver /Driver:C:\drivers\New_driver.inf
  5. If you have additional drivers in a folder, you can use the /Recurse option, which installs all the drivers from a folder and all its subfolders. To do this, type:

    Dism /Image:C:\test\offline /Add-Driver /Driver:c:\drivers /Recurse
  6. You can review the drivers in the Windows image by typing:

    Dism /Image:C:\test\offline /Get-Drivers
  7. In the list of drivers, notice that the added drivers have been renamed Oem*.inf. This ensures that all driver files in the driver store have unique names. For example, the New_Driver1.inf and New_Driver2.inf files are renamed Oem0.inf and Oem1.inf.

  8. To complete the operation, commit the changes and unmount the image by typing:

    Dism /Unmount-Image /MountDir:C:\test\offline /Commit

Manage driver packages with DISM

During the life of a Windows 10 installation, the system downloads and installs multiple versions of device driver packages over time. For devices with small hard-drive capacity, be aware of how to locate and delete outdated driver packages that the system retains.

You can use the built-in Disk Cleanup tool to remove device driver packages that have been kept after newer drivers are installed.

To clean up old device drivers by using the Disk Cleanup tool, perform these steps.

  1. Click the Start button, type Disk Cleanup, and then select the Disk Cleanup app.

  2. In the Drive Selection dialog box, select (C:) and click OK.

  3. On the Disk Cleanup results screen, select Clean Up System Files.

  4. In the Drive Selection dialog box, select (C:) and click OK.

  5. On the Disk Cleanup results screen, select Device Driver Packages and click OK.

  6. On the Are You Sure You Want To Permanently Delete These Files page, click Delete Files.

All driver packages that were installed during the Windows 10 setup process are stored in a directory called WinSxS, the side-by-side component store. This folder contains driver packages and operating system components so that you can add devices later without having to supply device drivers. If disk space is limited, you can purge the WinSxS directory contents, because it could occupy a significant amount of disk space.

To analyze the Windows Component Store for driver packages and other files that can be deleted, you can use the DISM command by using the following steps.

  1. Right-click the Start button, select Command Prompt (Admin), and type the following.

    DISM /Online /Cleanup-Image /AnalyzeComponentStore

    The tool analyzes your system. Typical results are shown in Figure 3-17.

    FIGURE 3-17

    FIGURE 3-17 Analyzing the Component Store (WinSxS) with DISM

  2. When the analysis is complete, you can initiate a cleanup of the Windows Component Store by typing the following command.

    DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase