Export Windows drivers with PowerShell

 •  Filed under export, windows, drivers, powershell

Need to reinstall Windows, but don't want to go through the hassle of getting all the needed drivers onto your new Windows installation? There's an easier way to work around that by using PowerShell! Just two cmdlets Get-WindowsDriver and Export-WindowsDriver are needed for this operation.

Obtaining a list of drivers is the first thing to do. You can use the Online and All flags to get a list of all the drivers from the currently running operating system. We put the output into a variable to be able to filter stuff later on:

$Drivers = Get-WindowsDriver -Online -All

Let's see out of which objects the variable exists so we can apply filters on this object:

PowerShell Driver Object

We can tell now that it's possible to filter on

  • Driver name;
  • Driver storage location and name;
  • Driver provider/manufacturer name;
  • Driver class/type;
  • Driver version;

You can also filter on date value, inbox value and boot criticality but it doesn't really bother me that much. If I want to fetch device drivers from a specific manufacturer for example, I can use this command:

$Drivers | where { $_.ProviderName -like "NVIDIA" }

Or if I want to list all types of drivers, I can use this:

$Drivers.ClassName | Sort-Object | Get-Unique

What if I wanted to get a list of all my network drivers?

$Drivers | where { $_.ClassName -like "*Net*" }

In case you need to export your drivers for e.g. migration purposes, this is what you want to run:

Export-WindowsDriver -Online -Destination "C:\Drivers"  

Especially the last command seems very useful to me. Next time I have to reinstall Windows, I know what to do 😉