After performing reinstall or clean Windows installation, the user is faced with the need to install the actual driver versions for the devices installed on the computer. Immediately after reinstalling the system, the user has to manually download the driver from the vendor’s website or use various Driver Packs tools (with which you can install different garbage and adware). However, there is an easier way to reinstall the device drivers in Windows 10 and 8.1. Not everyone knows that before reinstalling Windows you can create a backup copy of all the drivers installed on the system. With this backup you can quickly install all the necessary drivers during Windows clean install.
In this article we’ll show you the basic ways to create a backup of all the drivers installed in Windows and ways to restore the drivers from the backup without using third-party tools.
Exporting Drivers Using the Export-WindowsDriver Cmdlet
In Windows 8.1 Update 1 appeared a new Powershell cmdlet – Export-WindowsDriver, that allows to export all the installed third-party drivers (non-Microsoft ones) directly from the Driver Store (the Export-WindowsDriver cmdlet is already available in all Windows 10 builds). This cmdlet will greatly simplify and speed up the process of reinstalling Windows. Earlier, to create a backup copy of the drivers installed in the system, you had to use third-party apps (like DoubleDriver, DriverMax, etc).
So, to export all the installed third-party drivers directly from current Windows 10 or 8.1 image, start the PowerShell console as administrator and run the following command:
Export-WindowsDriver –Online -Destination c:\export-drivers
If you need to export drivers from the offline Windows image mounted, for instance, to the folder c:\win_image, 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 the exported drivers that are not a part of the OS.
As a result of running the PowerShell command, you will get a directory with a backup copy of all the drivers installed in your Windows. Each driver and all associated files are stored in their own directory, which is called by the name of the driver’s INF file.
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 in accordance with the list of files specified in the CopyFiles section of the driver’s inf file.
To display the list of all exported drivers in a convenient form with the indication of the class, vendor and the driver version, let’s export the drivers with the 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:
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 particular 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"}
How to Backup Drivers Using DISM
The DISM utility also provides the ability 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.
As you can see in our example, the DISM utility successfully exported 24 drivers to the specified directory.
Export Installed Device Drivers Using PNPUtil
In all versions of Windows, starting with Windows 7, there is an utility – the CLI tool PNPUtil.exe, which is usually used to add or remove drivers in Windows (previously we showed how to delete old and unnecessary drivers from Driver Store to save disk space).
Open an elevated command prompt and run the command:
pnputil.exe /export-driver * c:\export-drivers
The drivers from the resulting directory can be distributed to other systems manually using PowerShell or DISM (How to slipstream drivers to the Windows image) or automatically using scripts based on PNPUtil, DISM, PowerShell, MDT, SCCM, etc.
How to Restore Device Drivers from Backup
After reinstalling Windows, you can use the directory with a backup copy of the device drivers for installation in a clean system.
You can install a specific driver by right-clicking the INF file and selecting the “Install” menu item.
You can also install a specific device driver through the device manager. Open the Device Manager console, 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 to the appropriate drivers, select the option “Include subfolders”.
However, there is an easier way to install all the drivers which are contained in the backup 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 PoSh script sequentially scans all folders in the specified directory, searches for all inf files and installs drivers in the driver store using the PNPUtil utility.
You can also integrate all the drivers from the backup directory into the Windows image by using the Add-Driver argument of the DISM utility:
DISM /online /Add-Driver /Driver:C:\export-drivers /Recurse
You can add a driver both to the online and offline Windows image (see example How to inject USB 3.0 drivers into Windows 7 installation media).
So, in this article we looked at different ways to export and import drivers in Windows. Also ywe discussed a new cmdlet Export-WindowsDriver in Windows 10 and Windows 8.1 Update 1, that allows you to export all third-party drivers installed in the system into a separate folder.
4 comments
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
How can I then export that list into something else, like csv?
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
Cómo hago para importarlos a Windows 10, tras haber exportado los drivers?