DISM Driver Servicing (.inf) Command-Line Options

Use DISM with INF-style drivers to add, remove, or list drivers to an online or offline Windows image (.wim). Microsoft Windows Installer or other driver package types (such as .exe files) are not supported.

You can specify a directory where the driver INF files are located, or you can point to a driver by specifying the name of the INF file.

The base syntax for servicing a Windows image using DISM is:

DISM.exe {/Image:<path_to_ image_directory> | /Online} [dism_global_options] {servicing_option} [<servicing_argument>]

The following driver servicing options are available for an offline image.

DISM.exe /image:<path_to_image_directory> [/Get-Drivers | /Get-DriverInfo | /Add-Driver | /Remove-Driver | /Export-Driver]

The following driver servicing options are available for a running operating system.

DISM.exe /Online [/Get-Drivers | /Get-DriverInfo | /Export-Driver]

/Get-Help /?

When used immediately after a driver servicing command-line option, information about the option and the arguments is displayed. Additional topics might become available when an image is specified.

Examples:

Dism /image:C:\test\offline /Add-Driver /?
<p><strong>Dism /online /Get-Drivers /?

/Get-Drivers

Displays basic information about driver packages in the online or offline image.

By default, only third-party drivers will be listed. Use the /all argument to display information about default drivers and third-party drivers. Use the /Format:Table or /Format:List argument to display the output as a table or a list.

If you point to an image, you can determine what drivers are in the image, in addition to the state of the drivers (installed or staged).

Examples:

Dism /image:C:\test\offline /Get-Drivers
Dism /online /Get-Drivers

/Get-DriverInfo

Displays detailed information about a specific driver package.

Syntax:

 /Get-DriverInfo /Driver:{<installed_INF_FileName>|<path_to_driver.inf>}

You can point to an INF file installed in the image, or one that is not yet installed. You can specify the name of the uninstalled driver or the third-party driver in the device driver store. Installed third-party drivers in the driver store will be named Oem0.inf, Oem1.inf, and so on. This is referred to as the published name.

You can specify multiple drivers on the command line by using the /driver option multiple times.

Example: Use the /Get-Drivers option so that you can identify a driver INF file. Then run:

Dism /image:C:\test\offline /Get-DriverInfo /driver:C:\Drivers\usb.inf
Dism /online /Get-DriverInfo /driver:C:\test\drivers\usb\usb.inf

/Add-Driver

Adds third-party driver packages to an offline Windows image.

Syntax:

/Add-Driver {/Driver:<folder_containing_INF> | /Driver:<path_to_driver.inf>} [/recurse] [/ForceUnsigned]
  • /Driver can point to a folder or an individual .inf file.
    • When you use the /Driver option to point to a folder, INF files that are not valid driver packages are ignored. These files are reported on the console when the command runs, and a warning is included in the log file. You will not receive an error message.
    • If you point to a path and use the /Recurse option, all subfolders are queried for drivers to add.
  • For testing purposes you can use /ForceUnsigned to add unsigned drivers and override the requirement that drivers installed on X64-based computers must have a digital signature. For more information about driver signing requirements, see Device Drivers and Deployment Overview.

Examples:

Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers</strong>
Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers /recurse
Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers\mydriver.inf
Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers\mydriver.inf /ForceUnsigned

/Remove-Driver

Removes third-party drivers from an offline image.

You can specify multiple drivers on the command line by using the /Driver option multiple times.

Syntax:

/Remove-Driver /Driver:<driver_file>

When third-party drivers are added to an image, they're renamed to a published name like Oem0.inf, Oem1.inf, and so on. You must specify the published name to remove the driver. You cannot remove default drivers.

Warning

Removing a boot-critical driver package can make the offline Windows image unbootable.

Examples:

Dism /image:C:\test\offline /Remove-Driver /driver:oem1.inf
Dism /image: C:\test\offline /Remove-Driver /driver:oem1.inf /driver:oem2.inf

/Export-Driver

Exports all third-party driver packages from a Windows image to a destination path. The exported drivers can then be injected to an offline image by running the DISM Add-Driver command.

Syntax:

Export-Driver /Destination:<destination_path>
  • Destination is where the exported driver will be saved.

Examples:

DISM /Online /Export-Driver /Destination:C:\destpath
DISM /Image:C\test\offline /Export-Driver /Destination:C:\destpath

Limitations

  • The driver servicing command supports only .inf files. Windows Installer or other driver package types (such as .exe files) are not supported.

  • Drivers are installed in the order that they are listed in the command line. In the following example, 1.inf, 2.inf, and 3.inf will be installed in the order that they are listed in the command line.

    Dism /Image:C:\test\offline /Add-Driver /Driver:C:\test\drivers\1.inf /Driver:C:\test\drivers\2.inf /Driver:C:\test\drivers\3.inf
    

What is DISM?

DISM Image Management Command-Line Options

Deployment Image Servicing and Management (DISM) Command-Line Options