Skip to content

Instantly share code, notes, and snippets.

@jschlackman
Last active January 30, 2025 02:30
Show Gist options
  • Select an option

  • Save jschlackman/751b5c263d7778e748ae84db65052695 to your computer and use it in GitHub Desktop.

Select an option

Save jschlackman/751b5c263d7778e748ae84db65052695 to your computer and use it in GitHub Desktop.
<#
.SYNOPSIS
Downloads and installs the Windows 10 22H2 enablement package.
.DESCRIPTION
Downloads and installs the Windows 10 22H2 enablement package for machines not managed by a patch management system that supports feature updates natively (e.g. Windows Update, WSUS, Intune).
Requires Windows 10 build 2004 through 21H2.
Author: James Schlackman <[email protected]>
Last Modified: January 28, 2025
.NOTES
More information on Windows 10 feature enablement packages:
https://support.microsoft.com/en-us/topic/kb5015684-featured-update-to-windows-10-version-22h2-by-using-an-enablement-package-09d43632-f438-47b5-985e-d6fd704eee61
#>
# Check if Windows 10 and currently running a valid build number to receive the enablement package
If (([Environment]::OSVersion.Version.Major -eq 10) -and ([Environment]::OSVersion.Version.Build -lt 19045)) {
# Get OS architecture
$arch = If ($env:PROCESSOR_ARCHITEW6432) {$env:PROCESSOR_ARCHITEW6432} Else {$env:PROCESSOR_ARCHITECTURE}
Write-Output "$arch detected."
$updatePath = 'https://catalog.s.download.windowsupdate.com/c/upgr/2022/07'
# Download respective .msu
Write-Host 'Downloading...'
Switch ($arch)
{
AMD64 {
$msu = "$env:TEMP\windows10.0-kb5015684-x64.msu"
Invoke-WebRequest -Uri "$updatePath/windows10.0-kb5015684-x64_523c039b86ca98f2d818c4e6706e2cc94b634c4a.msu" -OutFile $msu
}
x86 {
$msu = "$env:TEMP\windows10.0-kb5015684-x86.msu"
Invoke-WebRequest -Uri "$updatePath/windows10.0-kb5015684-x86_556015f4260dd75ca30b3e84484ea5b3ec97fa08.msu" -OutFile $msu
}
ARM64 {
$msu = "$env:TEMP\windows10.0-kb5003791-arm64.msu"
Invoke-WebRequest -Uri "$updatePath/windows10.0-kb5015684-arm64_a4cc6e95084da14adb972e1d67cf573a244ed7a3.msu" -OutFile $msu
}
}
# If a download was retrieved, install the .msu
If (Test-Path $msu)
{
Write-Output "Installing $msu"
Start-Process $env:SystemRoot\System32\wusa.exe -ArgumentList "$msu /quiet /norestart"
Write-Output 'Enablement package install started, check Setup event log for progress.'
Exit 0
} Else {
Write-Output 'Failed to download enablement package.'
Exit 1
}
} Else {
Write-Output ('Windows build {0} not eligible for enablement package.' -f [Environment]::OSVersion.Version)
Exit 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment