Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / PowerShell / How to Export (Backup) and Restore Device Drivers in Windows 10 and 8.1

July 31, 2018 PowerShellWindows 10Windows 8

How to Export (Backup) and Restore Device Drivers in Windows 10 and 8.1

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.

Contents:
  • Exporting Drivers Using the Export-WindowsDriver Cmdlet
  • How to Backup Drivers Using DISM
  • Export Installed Device Drivers Using PNPUtil
  • How to Restore Device Drivers from Backup

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

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

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.

Export-WindowsDriver - powershell cmdlet

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.

backup windows drivers to a folder

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.

driver 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:

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 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"}

export driver by vendor

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.

export driver using dism

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

exporting instaled drivers using pnputil

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.

install driver from inf file

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”.

browse for device drivers

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
0
Facebook Twitter Google + Pinterest
previous post
Windows Defender Antivirus on Windows Server 2016
next post
Configuring Kerberos Authentication in Different Browsers

Related Reading

How to Sign a PowerShell Script (PS1) with...

February 25, 2021

How to Shadow (Remote Control) a User’s RDP...

February 22, 2021

Configuring PowerShell Script Execution Policy

February 18, 2021

Configuring Proxy Settings on Windows Using Group Policy...

February 17, 2021

Updating Group Policy Settings on Windows Domain Computers

February 16, 2021

4 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

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • Accessing USB Flash Drive from VMWare ESXi

    February 26, 2021
  • How to Sign a PowerShell Script (PS1) with a Code Signing Certificate?

    February 25, 2021
  • Change the Default Port Number (TCP/1433) for a MS SQL Server Instance

    February 24, 2021
  • How to Shadow (Remote Control) a User’s RDP session on RDS Windows Server 2016/2019?

    February 22, 2021
  • Configuring PowerShell Script Execution Policy

    February 18, 2021
  • Configuring Proxy Settings on Windows Using Group Policy Preferences

    February 17, 2021
  • Updating Group Policy Settings on Windows Domain Computers

    February 16, 2021
  • Managing Administrative Shares (Admin$, IPC$, C$, D$) in Windows 10

    February 11, 2021
  • Packet Monitor (PktMon) – Built-in Packet Sniffer in Windows 10

    February 10, 2021
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10

    February 5, 2021

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Install RSAT Feature on Demand on Windows 10 1809 and Later
  • Get-ADUser: Getting Active Directory Users Info via PowerShell
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • Get-ADComputer: Find Computer Details in Active Directory with PowerShell
  • PSWindowsUpdate: Managing Windows Updates from PowerShell
  • PowerShell: Get Folder Sizes on Disk in Windows
  • Adding Third-Party Drivers into VMWare ESXi 6.7 ISO Image
Footer Logo

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


Back To Top