Skip to content

Instantly share code, notes, and snippets.

@jschlackman
Created July 11, 2022 19:59
Show Gist options
  • Save jschlackman/751b5c263d7778e748ae84db65052695 to your computer and use it in GitHub Desktop.
Save jschlackman/751b5c263d7778e748ae84db65052695 to your computer and use it in GitHub Desktop.
# Downloads and installs the Windows 10 21H2 enablement package for machines not managed by Windows Update or WSUS.
# Requires Windows 10 2004, 20H2, or 21H1
# https://support.microsoft.com/en-us/topic/kb5003791-update-to-windows-10-version-21h2-by-using-an-enablement-package-8bc077be-18d7-4aac-81ce-6f6dad2cd384
# Check if Windows is currently running a valid build number to receive the enablement package
If ([Environment]::OSVersion.Version.Build -in 19041..19043) {
# Get OS architecture
$arch = If (!$env:PROCESSOR_ARCHITEW6432) {$env:PROCESSOR_ARCHITECTURE}
# Download respective .msu
Switch ($arch)
{
AMD64 {$msu = "$env:TEMP\windows10.0-kb5003791-x64.msu"; Invoke-WebRequest -Uri 'http://b1.download.windowsupdate.com/d/upgr/2021/11/windows10.0-kb5003791-x64_14e7547b08f1b29cae6e41c9f7da5f1347d9955c.msu' -OutFile $msu}
x86 {$msu = "$env:TEMP\windows10.0-kb5003791-x86.msu"; Invoke-WebRequest -Uri 'http://b1.download.windowsupdate.com/d/upgr/2021/11/windows10.0-kb5003791-x86_ac1fc53b104c6ce0ffa50b70af754b81e56829ce.msu' -OutFile $msu}
ARM64 {$msu = "$env:TEMP\windows10.0-kb5003791-arm64.msu"; Invoke-WebRequest -Uri 'http://b1.download.windowsupdate.com/d/upgr/2021/11/windows10.0-kb5003791-arm64_047071577e1aa33883b851a8b2c749b1e723e369.msu' -OutFile $msu}
}
# If a download was retrieved, install the .msu
If (Test-Path $msu)
{
Start-Process $env:SystemRoot\System32\wusa.exe -ArgumentList "$msu /quiet /norestart"
Write-Output 'Enablement package install started, check Setup event log for progress.'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment