Created
April 17, 2017 17:50
-
-
Save milesgratz/9b89999d2f4b54eb1ccdb539abaa3441 to your computer and use it in GitHub Desktop.
Example to expand and install driver cabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$CabPath = "C:\temp" | |
$CabFiles = Get-ChildItem $CabPath\*.cab | |
# Expand Cabs into folder based on their Name | |
foreach ($Cab in $CabFiles){ | |
$Directory = New-Item -Path $CabPath\$($Cab.BaseName) -ItemType Directory -Force | |
expand $Cab.FullName -F:* $Directory.FullName | |
} | |
# Install drivers inside each cab | |
foreach ($Cab in $CabFiles){ | |
$infs = Get-ChildItem -Path $CabPath\$($Cab.BaseName) -Filter "*.inf" -Recurse -File | |
foreach($inf in $infs){ | |
Write-Host Installing $inf.FullName | |
pnputil.exe -i -a ""$inf.FullName"" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment