Documentation Center

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support Portal
  • Home
  • Assets & RMM
  • Scripting & APIs

Force Office C2R Versions to Update

Contact Us

If you have questions or want help, please Submit a Request.

Updated at Jan 23, 2025
By Kali Patrick

Related Docs

  • Manage Scripts
  • Update the Syncro Agent from Windows 10 to Windows 11

When you receive an email stating that Microsoft released a critical patch for Outlook, you might wonder how other MSPs roll out fixes like this.

If you'd like an automated way to do this that works and adds value for your customers, below is a script you can use to force Office Click-to-Run (C2R) versions to update.

Note: The forceappshutdown=true option will close any open Office apps. Either run it after-hours or change it to false.

Import-Module $env:SyncroModule

# Check if running as System
$sid = ([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value
if ($sid -ne "S-1-5-18") {
    Write-Host "This script needs to be run as System."
    Exit 1
}

$c2rPaths =@(
    "$($env:ProgramFiles)\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe"
    "${env:ProgramFiles(x86)}\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe"
)

# Add a flag to indicate whether the update was performed or not
$updatePerformed = $false

# Check each path to see which is correct
foreach ($c2rPath in $c2rPaths) {
    $pathExists = Test-Path -Path $c2rPath -PathType Leaf
    if ($pathExists) {
        Write-Host "Updating Office using C2R located at '$($c2rPath)'."

        try {           
            $result = Start-Process -FilePath $c2rPath -ArgumentList "/update user displaylevel=false updatepromptuser=false forceappshutdown=true" -PassThru -Wait
        } catch {
            Write-Host "An error occurred updating Office."
            Exit 1
        }
        
        if ($result.ExitCode -eq 0) {
            Write-Host "Successfully called the Office C2R updater."
            $updatePerformed = $true # Set the flag to true when the update is successful
        } else {
            Write-Host "The Office C2R updater was not called successfully. Please investigate."
            Rmm-Alert -Category "Windows | Application Management" -Body "The Office C2R updater was not called successfully. Please investigate."
            Exit 1
        }
    }
}

# Output a message if the OfficeC2RClient.exe file wasn't found and exit with error code 2
if (-not $updatePerformed) {
    Write-Host "OfficeC2RClient.exe was not found. Unable to update Office."
    Exit 2
}

 

Was this article helpful?

Yes
No
Give feedback about this article

The integrated platform for running a profitable MSP business

Syncro All-in-one MSP Software Facebook Syncro All-in-one MSP Software Twitter Syncro All-in-one MSP Software LinkedIn Syncro All-in-one MSP Software YouTube Syncro All-in-one MSP Software Reddit
  • Compliance
  • Privacy Policy
  • Website Terms
  • Service Terms
Knowledge Base Software powered by Helpjuice

© 2017-2024 Servably, Inc. All rights reserved.

Expand