Prerequisite: Must have PowerShell 5.0 or higher
This will backup all 3rd party drivers in a Windows based computer.
clear
if ($PSVersionTable.PSVersion.Major -lt 5)
{
Write-Output "Your version of PowerShell is not supported please upgrade to 5.0 or higher"
}
else
{
$ExportDirectory="$($env:USERPROFILE)\Desktop\DriverBackup"
Write-Output "Creating temporary directory for the driver files."
New-Item -Path $($ExportDirectory) -ItemType Directory | Out-Null
#cd $($ExportDirectory)
Write-Output "Creating a text file list of all the drivers"
$(Get-WindowsDriver -All -Onlines) | Out-File "$($ExportDirectory)\DriverList.txt"
Write-Output "Exporting drivers to $($ExportDirectory)"
Export-WindowsDriver -Online -Destination $($ExportDirectory)
Write-Output "Archiving files into a zip file"
Compress-Archive -Path "$($ExportDirectory)" -CompressionLevel Fastest -DestinationPath "$($env:USERPROFILE)\Desktop\DriverBackup.zip" | Out-Null
#cd "$($env:USERPROFILE)\Desktop"
Write-Output "Removing temporary directory"
Remove-Item -Recurse -Path $ExportDirectory
}
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.