Skip to main content
  1. Posts/

How to Upgrade ConfigMgr via PowerShell

·

The following will show you how to upgrade a ConfigMgr site to the latest available update.

# Import the ConfigurationManager module
Import-Module -Name ConfigurationManager

# Get the site code
$SiteCode = (Get-CimInstance -Namespace ROOT/SMS -ClassName SMS_ProviderLocation).SiteCode

# Change to the site psdrive
Set-Location -Path "$($SiteCode):"

# Find the latest update
$LatestSiteUpdate = (Get-CMSiteUpdate -Fast | Sort-Object -Descending -Property LastUpdateTime | Select-Object -First 1).Name

# Install the update
Install-CMSiteUpdate -Name $LatestSiteUpdate -Confirm:$false -Force

The above script is also available in my GitHub.

Anthony J. Fontanez
Author
Anthony J. Fontanez