Last active
January 30, 2024 12:39
-
-
Save nicolonsky/b04dd77129577f782178c0c049344101 to your computer and use it in GitHub Desktop.
Intune / Configuration Manager Proactive Remediation to trigger Office Click to Run Updater (intended to run for the logged on user to show built-in update pop-up)
This file contains 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
# See Microsoft 365 Apps Version history https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date#version-history | |
$targetVersions = @{ | |
'CurrentChannel' = [System.Version]::Parse('16.0.16130.20306') | |
'MonthlyEnterpriseChannel1' = [System.Version]::Parse('16.0.16026.20238') | |
'MonthlyEnterpriseChannel2' = [System.Version]::Parse('16.0.15928.20298') | |
'Semi-AnnualEnterpriseChannel(Preview)' = [System.Version]::Parse('16.0.16130.20306') | |
'Semi-AnnualEnterpriseChannel1' = [System.Version]::Parse('16.0.15601.20578') | |
'Semi-AnnualEnterpriseChannel2' = [System.Version]::Parse('16.0.14931.20944') | |
'CurrentChannel(Preview)' = [System.Version]::Parse('16.0.16227.20094') | |
} | |
$configuration = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" | |
$displayVersion = $null | |
if ( [System.Version]::TryParse($configuration.VersionToReport, $([ref]$displayVersion))) { | |
Write-Output ("Discovered VersionToReport {0}" -f $displayVersion.ToString()) | |
$targetVersion = $targetVersions.Values | Where-Object { $_.Build -eq $displayVersion.Build } | Select-Object -Unique -First 1 | |
Write-Output ("Mapped minimum target version to {0}" -f $targetVersion.ToString()) | |
if ($null -eq $targetVersion -or $displayVersion -lt $targetVersion) { | |
Write-Output ("Current Office365 Version {0} is lower than specified target version {1}" -f $displayVersion.ToString(), $targetVersion.ToString()) | |
Write-Output "Triggering remediation..." | |
Exit 1 | |
} else { | |
Write-Output ("Current Office365 Version {0} matches specified target version {1}" -f $displayVersion.ToString(), $targetVersion.ToString()) | |
Exit 0 | |
} | |
} else { | |
throw "Unable to parse VersionToReport for Office" | |
} |
This file contains 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
$processArgs = @{ | |
'FilePath' = "$env:ProgramFiles\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe" | |
'ArgumentList' = "/update user" | |
'Wait' = $true | |
} | |
if (-not (Test-Path $processArgs['FilePath'])) { throw "OfficeC2RClient.exe not found!" } | |
Start-Process @processArgs |
Can someone help? I am getting No Office ClickToRun on some computers even though they are running office 365 C2R version
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@TomislavPeharec thank you so much.