For the Surface Pro 6 I ended up downloading four .msi files and needed to extract them to get the drivers for import into SCCM. I wrote this little PowerShell script to iterate through all four and extract them for me complete with logs in case anything went wrong. Figured I would post it here in case anyone else finds it useful.
#Extract-MSIFiles.PS1
#Creates folders for each .msi and extracts contents into the folders
#By Mark Randol - randoltech.blogspot.com
$BasePath = "C:\Users\me\Downloads\Drivers\Surface Pro 6 1796 Commercial"
Start-Transcript -Path "$BasePath\Extract-MSIFiles.log" -Force
$SearchPath = $BasePath + "\*"
$MSIFiles = Get-ChildItem $SearchPath -Include *.msi
foreach ($File in $MSIFiles) {
$FileName = $File.Name
New-Item -Path "$BasePath" -Name $File.BaseName -ItemType "Directory"
$ExtractFolder = $BasePath + "\" + $File.BaseName
$ArguementString = "/a ""$BasePath" + "\" + "$Filename"" targetdir=""$ExtractFolder"" /l*v ""$BasePath\$FileName.log"" /qn"
Start-Process -FilePath "msiexec.exe" -ArgumentList $ArguementString
Wait-Process -Name msiexec -Timeout 90
}
Stop-Transcript
-Enjoy
No comments:
Post a Comment