Skip to content

Instantly share code, notes, and snippets.

@OSDeploy
Created February 22, 2019 07:46
Show Gist options
  • Save OSDeploy/079b2159264c12f3b1928db7cad95f85 to your computer and use it in GitHub Desktop.
Save OSDeploy/079b2159264c12f3b1928db7cad95f85 to your computer and use it in GitHub Desktop.
Office Update Test Script Thanks Sune
$Updates = Get-ChildItem "C:\Users\OSDUpdate\Desktop\Office 2016 64-Bit\updates" -Recurse -File -Include *.msp | Select-Object -Property *
$Updates = $Updates | Sort-Object -Property LastWriteTime
Measure-Command -Expression {
Write-Host "`n"
Write-Host "=====================================================================================" -ForegroundColor DarkGray
Write-Host "Installing Microsoft Office 2016 updates"
Write-Host "=====================================================================================" -ForegroundColor DarkGray
ForEach ($Update in $Updates) {
Try {
$Count++
Write-Host "Installing: $($Update.Fullname)" -foregroundcolor "Green"
msiexec /p "$($Update.FullName)" /qn REBOOT=ReallySuppress MSIRESTARTMANAGERCONTROL=Disable | Out-Null
}
Catch {
$Count--
Write-Host "Attention: $($Update.Fullname) were not installed!" -foregroundcolor "Cyan"
}
}
Write-Host "=====================================================================================" -ForegroundColor DarkGray
Write-Host $Count "Updates were installed."
Write-Host "=====================================================================================" -ForegroundColor DarkGray
} | ft @{n="Total installation time";e={$_.Hours,"Hours",$_.Minutes,"Minutes",$_.Seconds,"Seconds",$_.Milliseconds,"Milliseconds" -join " "}}
Pause
@OSDeploy
Copy link
Author

Sorry about the hard coded path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment