Skip to content

Instantly share code, notes, and snippets.

@rayterrill
Created June 8, 2016 20:20
Show Gist options
  • Save rayterrill/6c5d43485b2b3e83969a6e084f2d30c5 to your computer and use it in GitHub Desktop.
Save rayterrill/6c5d43485b2b3e83969a6e084f2d30c5 to your computer and use it in GitHub Desktop.
function Install-WMF5 ($WMF5location, $server) {
Invoke-Command -ComputerName $server -ScriptBlock { New-Item c:\temp\WMF5 -Type Directory -Force -ErrorAction 'SilentlyContinue' | Out-Null }
$serverTempLocation = "\\$($server)\c`$\Temp\WMF5\"
#copy the wmf5 file from a central location to our server at c:\temp\wmf5
Copy-Item $WMF5location $serverTempLocation
#use wusa to extract the cab file to install the wmf5 package
$scriptBlock = { Start-Process -FilePath 'wusa.exe' -ArgumentList "c:\temp\WMF5\Win8.1AndW2K12R2-KB3134758-x64.msu /extract:C:\temp\WMF5\" -verb runAs -Wait -PassThru }
Write-Host "Extracting the WMF5 update to get the cab..."
Invoke-Command -ComputerName $server -ScriptBlock $scriptBlock | Out-Null
#use dism to install the cab file for wmf5
$scriptBlock = { Start-Process -FilePath 'dism.exe' -ArgumentList "/online /add-package /PackagePath:C:\temp\WMF5\WindowsBlue-KB3134758-x64.cab /NoRestart" -Wait -PassThru }
Write-Host "Applying the update (this will take a few minutes)..."
Invoke-Command -ComputerName $server -ScriptBlock $scriptBlock | Out-Null
Write-Host "WMF5 installation complete!"
}
Install-WMF5 -WMF5Location "\\MyFileServer\WMF5\Win8.1AndW2K12R2-KB3134758-x64.msu" -server MyTargetServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment