Created
February 22, 2019 07:46
-
-
Save OSDeploy/079b2159264c12f3b1928db7cad95f85 to your computer and use it in GitHub Desktop.
Office Update Test Script Thanks Sune
This file contains hidden or 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
$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry about the hard coded path