Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows 10 / How to Backup (Export) and Restore Device Drivers on Windows 10?

September 3, 2021 PowerShellWindows 10Windows Server 2019

How to Backup (Export) and Restore Device Drivers on Windows 10?

After reinstall/clean install Windows, the user needs to install the latest driver versions for the devices installed on the computer. The user must manually find, download and install the necessary drivers. However, there is an easier way to install the device drivers on Windows 10 and 8.1. You can back up (export) all the installed drivers before reinstalling Windows and use such a backup to quickly install all drivers on a clean Windows installation.

In this article, we’ll show you the basic ways to backup and restore all the drivers installed in Windows using built-in tools (DISM, pnputil.exe, or Export-WindowsDriver PowerShell cmdlet).

Contents:
  • PowerShell: Backup Drivers Using the Export-WindowsDriver Cmdlet
  • Backup Drivers on Windows 10 Using DISM
  • Exporting Installed Device Drivers Using PNPUtil
  • How to Restore Device Drivers on Windows 10?

PowerShell: Backup Drivers Using the Export-WindowsDriver Cmdlet

On Windows 10 and Windows Server 2019/2016, you can use the Export-WindowsDriver PowerShell cmdlet to export all third-party (non-Microsoft) drivers installed on the device directly from the Driver Store. This cmdlet allows you to greatly simplify and speed up the process of reinstalling Window. Previously, to create a backup copy of the drivers installed on the computer, you had to use third-party apps (like DoubleDriver, DriverMax, etc).

In order to export all the installed third-party drivers directly from the current Windows 10 online image, open the PowerShell console as administrator and run the following command:

Export-WindowsDriver –Online -Destination c:\export-drivers

Note. The driver files are saved to the directory c:\export-drivers. It must be created in advance.

If you need to extract drivers from the offline Windows image mounted, the command should look like this:

Export-WindowsDriver -Path c:\win_image -Destination c:\export-drivers

After running the cmdlet, the screen displays information about all exported third-party drivers. You will get a backup copy of all Windows drivers from the C:\Windows\System32\DriverStore\FileRepository\ directory. Each driver and all associated files are saved in its own directory, which is named by the name of the driver’s INF file.

Export-WindowsDriver PowerShell cmdlet to backup device drivers

Each directory contains all the files that are necessary to install the driver (not only *.inf files, but all associated *.sys, *.dll, *.exe, and other types of files). The Export-WindowsDriver cmdlet builds a list of files that are required to install the driver as specified in the CopyFiles section of the driver inf file.

driver inf file

To display a list of saved drivers in a convenient form with the class, vendor, and the driver version, let’s export the drivers using two commands:

$BackupDrv = Export-WindowsDriver -Online -Destination c:\export-drivers

After that let’s display the results in the table:

$BackupDrv | Select-Object ClassName, ProviderName, Date, Version | Sort-Object ClassName

As you can see, the resulting table shows the driver class, manufacturer, version, and date.

list exported drivers class, vendor and version

You can save information about exported drivers to a CSV file:

$BackupDrv| Select-Object ClassName, ProviderName, Date, Version |Export-Csv c:\ps\backup_drivers_list.txt

You can list the drivers for a specific device class using the ClassName attribute. For example, to list only printer drivers run the following command:

$BackupDrv | where { $_.classname -like "printer" }

To display a list of drivers for a specific vendor, use the command:

$BackupDrv | Where{ $_.ProviderName -Match "NVIDIA"}

export driver by vendor

You can name the driver directory according to your computer model and save a backup of the drivers to a shared network folder where you store drivers for all computer models. In this case, use the command:

Export-WindowsDriver -Destination "\\mun-fs01\drivers\desktop\$((Get-WmiObject -Class win32_computersystem).Model)" -Online

use shared backup driver folder for each computer model

As you can see, a directory has been created with the name of the computer model and all drivers are exported in it.

[/alert]

Backup Drivers on Windows 10 Using DISM

You can also use the DISM.exe to backup drivers and import them into a Windows image. To export all drivers to the C:\export-drivers directory, open an elevated command prompt and run the command:

dism /online /export-driver /destination:C:\export-drivers

Exporting 1 of 24 – oem0.inf: The driver package successfully exported.

export driver using dism

As you can see in our example, the DISM tool successfully exported 24 drivers to the specified directory.

Exporting Installed Device Drivers Using PNPUtil

You can manage device drivers on your computer using the built-in PNPUtil.exe tool. This tool is commonly used to add or remove drivers in Windows (previously we showed how to remove old and unused device drivers from the Windows Driver Store to save disk space). The PNPUtil can also be used to export drivers from the Windows repository.

Open an elevated command prompt and run the command:

pnputil.exe /export-driver * c:\export-drivers

exporting instaled drivers using pnputil

Drivers from the resulting directory can be deployed to other devices manually using PowerShell, PNPUtil, DISM (How to slipstream drivers into a Windows image), or automatically with MDT, SCCM, etc.

With pnputil, you can only export a specific device driver. To do this, you need to get the name of its INF file.

Get a complete list of installed drivers:

pnputil.exe /enum-drivers

Or you can use PowerShell to filter the list of drivers. I only need to export the Realtek NIC drivers:

Get-WindowsDriver -Online | where { ($_.ProviderName -like "Realtek") –and ($_.ClassName -like "Net")}

Copy the name of the inf file (oem5.inf) and run the following command to export the driver files:

mkdir c:\drivers\realtek
pnputil.exe /export-driver oem5.inf c:\drivers\realtek

As a result, you exported the NIC inf file (rt640x64.inf) with all the necessary files.

export only one specific driver in windows using pnputil

How to Restore Device Drivers on Windows 10?

You can use the directory with a backup copy of the device drivers to install them on a clean Windows installation (or after reinstalling Windows).

To install a specific driver, right-click on the INF file and select the “Install” menu item.

install driver from inf file

You can also update a specific device driver through the device manager. Open the Device Manager console (devmgmt.msc), select the device which driver you want to replace, click “Update Driver” -> “Browse my computer for driver software“. Specify the path to the directory with the drivers’ backup. To automatically scan all subfolders for inf files, select the option “Include subfolders”.

browse for device drivers

However, there is an easier way to install (import) all the drivers from the specified directory at once. To do this, use the following PowerShell script:

$drvinffiles = Get-ChildItem -Path "C:\export-drivers\" -Filter "*.inf" -Recurse -File
foreach($drvinffile in $drvinffiles){
$drvinffile.FullName
pnputil.exe -i -a "$drvinffile.FullName"
}

This PowerShell script sequentially scans all folders in the specified directory, searches for all inf files, and installs drivers in the Driver Store using the PNPUtil tool.

Pnputil on Windows 10 allows you to install all drivers from a specified folder (including subfolders) using a simple one-liner:

pnputil.exe /add-driver C:\export-drivers\*.inf /subdirs /install

You can also import all the drivers from the backup directory into the offline Windows image by using the Add-Driver parameter of the DISM tool (in this example, we allow the installation of unsigned drivers):

DISM /image:c:\win_image /Add-Driver /Driver:C:\export-drivers /Recurse /ForceUnsigned

You can slipstream a driver using DISM only into an offline Windows image (see example How to add USB 3.0 drivers into Windows 7 installation media).

Be sure to back up your installed drivers before reinstalling Windows.

5 comments
5
Facebook Twitter Google + Pinterest
previous post
Automatically Add Static Routes After Connecting to VPN
next post
How to Hide Users and Groups from the Global Address List on Exchange/Office 365?

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

November 7, 2023

Send Emails with Microsoft Graph API and PowerShell

November 6, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

5 comments

Lucas June 14, 2015 - 6:26 pm

Thanks so much! I was looking for something exactly like this. Just did the backup, and next week when my new ssd arrives, I will test how it will work on the restore part. Thanks again

Reply
Chris August 7, 2015 - 2:20 pm

How can I then export that list into something else, like csv?

Reply
Max August 14, 2015 - 10:58 am

Use this Powershell command to export output of Export-WindowsDriver to CSV file:
$BackupDrivers | Select-Object ClassName, ProviderName, Date, Version |Export-Csv c:\temp\test.txt

Reply
alejandro October 12, 2016 - 2:54 am

Cómo hago para importarlos a Windows 10, tras haber exportado los drivers?

Reply
Duke June 18, 2022 - 8:18 pm

Awesome!

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • Adding Drivers into VMWare ESXi Installation Image
  • How to Hide Installed Programs in Windows 10 and 11
  • Configuring SFTP (SSH FTP) Server on Windows
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top