Skip to content

Instantly share code, notes, and snippets.

@mikezter
Created July 29, 2018 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikezter/ec61156aabc046024866fdc503285459 to your computer and use it in GitHub Desktop.
Save mikezter/ec61156aabc046024866fdc503285459 to your computer and use it in GitHub Desktop.
pnputil /enum-drivers > ./driveroutput.txt
Get-Content .\driveroutput.txt | Select-String -Pattern "Published Name" | %{$_.Line.Split(" ")} | Select-String -Pattern ".inf" | Where { $_ } | Set-Content .\oems.txt
foreach($line in Get-Content .\oems.txt) {
pnputil.exe /delete-driver $line
}
@mikezter
Copy link
Author

Removes currently unused drivers from Windows DriverStore FileRepository.
Will probably also remove drivers of currently disconnected devices, like webcams etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment