Microsoft 365 / Office - Updating
-
Updating your Microsoft 365 installations using Custom Software is very easy.
We have made the below simple sample code, which will update it in a safe manner.
You may want to alter this:
/update user displaylevel=false forceappshutdown=false
The displaylevel can be set to true, then the user will see a popup.
And you would be able to close the apps by changing forceappshutdown to true. Our tests shows that this is safe, as it doesn't close the apps, if people have unsaved documents open. However, please test this on a few hosts, before doing this across the entire company network.
$path64 = "C:\Program Files\Common Files\microsoft shared\ClickToRun" $path32 = "C:\Program Files (x86)\Common Files\microsoft shared\ClickToRun" $file = "OfficeC2RClient.exe" $arguments = "/update user displaylevel=false forceappshutdown=false" function updateOffice ($clicktorun, $arguments) { Start-Process -PassThru -FilePath $clicktorun -ArgumentList $arguments } if (Test-Path -LiteralPath "$path32\$file" -PathType Leaf -ErrorAction SilentlyContinue) { updateOffice -clicktorun $path32\$file -arguments $arguments } elseif (Test-Path -LiteralPath "$path64\$file" -PathType Leaf -ErrorAction SilentlyContinue) { updateOffice -clicktorun $path64\$file -arguments $arguments } else { Write-Host "Error: $file not found in default locations, aborting." }
NOTE: A signed edition of the script can be found here:
https://stream.vulndetect.com/e/update-office.ps1Remember to select All files:
-