Patch multi versions of windows via Power shell
$version = Get-WmiObject -Class Win32_OperatingSystem | ForEach-Object -MemberName Caption switch -wildcard($version)
{
"*2008 R2*" {
iwr https://s3-us-west-2.amazonaws.com/vss-script/4483229/2008r2ie11.msu -outfile "$env:TEMP\2008r2ie11.msu"
Start-Process "wusa.exe" -ArgumentList "$env:TEMP\2008r2ie11.msu /quiet " -Wait -PassThru
exit
} "*2012 R2*" {
iwr https://s3-us-west-2.amazonaws.com/vss-script/4483229/2012r2ie11.msu -outfile "$env:TEMP\2012r2ie11.msu"
Start-Process "wusa.exe" -ArgumentList "$env:TEMP\2012r2ie11.msu /quiet " -Wait -PassThru
exit
} "*2008*" {
iwr https://s3-us-west-2.amazonaws.com/vss-script/4483229/2008ie9.msu -outfile "$env:TEMP\2008ie9.msu"
Start-Process "wusa.exe" -ArgumentList "$env:TEMP\2008ie9.msu /quiet " -Wait -PassThru
exit
} "*2012*" {
iwr https://s3-us-west-2.amazonaws.com/vss-script/4483229/2012ie10.msu -outfile "$env:TEMP\2012ie10.msu"
Start-Process "wusa.exe" -ArgumentList "$env:TEMP\2012ie10.msu /quiet " -Wait -PassThru
exit
} "*2016*" {
iwr https://s3-us-west-2.amazonaws.com/vss-script/4483229/2016.msu -outfile "$env:TEMP\2016.msu"
Start-Process "wusa.exe" -ArgumentList "$env:TEMP\2016.msu /quiet " -Wait -PassThru
exit
} "*" {
"unknown operating system"
exit
} }