Skip to content

Instantly share code, notes, and snippets.

@contactbrenton
Created February 14, 2024 04:57
Show Gist options
  • Save contactbrenton/00862c106c3facae1e5cd0d6014c48e3 to your computer and use it in GitHub Desktop.
Save contactbrenton/00862c106c3facae1e5cd0d6014c48e3 to your computer and use it in GitHub Desktop.
Updates Office Click to Run
# Check for Office Click-To-Run Products
$officeC2R = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*,HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.DisplayName -like "*Microsoft Office Professional Plus 2019*" -or $_.DisplayName -like "*Microsoft Office Professional Plus 2021*" -or $_.DisplayName -like "*Microsoft Office 365*" -or $_.DisplayName -like "*Microsoft 365*"}
# Update Click-To-Run Office Products (Office 2019, 2021, 365, etc)
if ($officeC2R -ne $null) {
if (Test-Path "C:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe") {
Write-Output "Click-To-Run Office detected. Initiating update."
& "C:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe" /update user displaylevel=false forceappshutdown=true
}
else {
Write-Output "No Click-To-Run Office detected."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment