Last active
January 29, 2025 18:23
-
-
Save wise-io/94aab9d0936908cd0e933a08351e818c to your computer and use it in GitHub Desktop.
PowerShell Script to Initiate Microsoft Office Updates
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
# Initiates Microsoft Office updates | |
$Path = 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe' | |
$Arguments = '/update user' | |
# Get the process name | |
$ProcessName = [System.IO.Path]::GetFileNameWithoutExtension($Path) | |
# Check if Microsoft Office updates are running | |
$Running = Get-Process $ProcessName -ErrorAction SilentlyContinue | |
# If not running, start Microsoft Office updates | |
if (!$Running) { | |
Write-Output 'Starting Microsoft Office update process...' | |
Start-Process -FilePath $Path -ArgumentList $Arguments | |
} | |
else { | |
Write-Output 'The Microsoft Office update process is currently running.' | |
} |
Thanks for the kind words @ColossusD88! Be sure to check out the maintained version of this script here, and my documentation site at https://scripts.aaronjstevenson.com/ for other useful scripts.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is it corrected without the else } cmdlet error argument it will kick back. Thank you so much by the way Wise-io!
Initiates Microsoft Office updates
$Path = 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe'
$Arguments = '/update user'
Get the process name
$ProcessName = [System.IO.Path]::GetFileNameWithoutExtension($Path)
Check if Microsoft Office updates are running
$Running = Get-Process $ProcessName -ErrorAction SilentlyContinue
If not running, start Microsoft Office updates
if (!$Running) {
Write-Output 'Starting Microsoft Office update process...'
Start-Process -FilePath $Path -ArgumentList $Arguments
} else {
Write-Output 'The Microsoft Office update process is currently running.'
}