Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Forked from jonman364/RemoveDrivers.ps1
Last active April 24, 2018 17:55
Show Gist options
  • Save pythoninthegrass/675b625f1623635c8e3141ca4a4ca85a to your computer and use it in GitHub Desktop.
Save pythoninthegrass/675b625f1623635c8e3141ca4a4ca85a to your computer and use it in GitHub Desktop.
Remove all OEM drivers from an offline image
$image = “D:\Windows\System32\DriverStore\FileRepository” # may just need mounted Windows root dir (e.g., "D:\")
$dism = dism /image:$image /get-drivers
ForEach($line in $dism){
If($line -like “Published Name*”){
$sp = ($line -split “ “)
$oem = $sp[3]
Dism /image:$image /Remove-Driver /Driver:$oem # /Recurse
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment