Here is a worklet for upgrading Windows feature builds using Windows Update Assistant. This method performs an immediate upgrade and does not require the feature build to become available within Automox, nor does it require prerequisites and enablement updates to push first.
Note: Within the evaluation code, uncomment the build you want to target. For example, the evaluation code as it stands now will check for 21H2 (10.0.19044) as being the target build.
Evaluation Code:
$Version = (Get-CimInstance Win32_OperatingSystem).Version
#Uncomment the build you would like to upgrade to.
Switch ($Version) # skip current 21H2 version only
{
#10.0.10240 {Write-Output "Already on 10240" exit 0} # Threshold 1 - 1507
#10.0.10586 {Write-Output "Already on 10586" exit 0} # Threshold 2 - 1511
#10.0.14393 {Write-Output "Already on 14393" exit 0} # Redstone 1 - 1607
#10.0.15063 {Write-Output "Already on 15063" exit 0} # Redstone 2 - 1703
#10.0.16299 {Write-Output "Already on 16299" exit 0} # Redstone 3 - 1709
#10.0.17134 {Write-Output "Already on 17134" exit 0} # Redstone 4 - 1803
#10.0.17763 {Write-Output "Already on 17763" exit 0} # Redstone 5 - 1809
#10.0.18362 {Write-Output "Already on 18362" exit 0} # 19H1 - 1903
#10.0.18363 {Write-Output "Already on 18363" exit 0} # 19H2 - 1909
#10.0.19041 {Write-Output "Already on 19041" exit 0} # 20H1 - 2004
#10.0.19042 {Write-Output "Already on 19042" exit 0} # 20H2
#10.0.19043 {Write-Output "Already on 19043" exit 0} # 21H1
10.0.19044 {Write-Output "Already on 19044" exit 0} # 21H2
#10.0.19045 {Write-Output "Already on 19045" exit 0} # 22H2
}
exit 1
Remediation Code:
# Define Values in this section
#############################################
$rValue = '1' #Enable Target Release Version 0 = Disabled, 1 = Enabled
$rInfoValue = '21H2' #Specify Windows 10 Target Release Version. Select the preferred version from https://docs.microsoft.com/en-us/windows/release-information/
$rWindows = 'Windows 10' #Specify Windows 10 or Windows 11
#############################################
$rPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate'
$rKeyPath = 'HKLM:\Software\Policies\Microsoft\Windows'
$rVersion = 'TargetReleaseVersion'
$rVersionInfo = 'TargetReleaseVersionInfo'
$rVersionWindows = 'ProductVersion'
$rBlock = 'DisableWUfBSafeguards'
try
{
if (-not(Test-Path -path $rPath))
{
New-Item -Path $rPath -Force -ErrorAction SilentlyContinue | Out-Null
}
Write-Output "SUCCESS: Target Release Version keys set`t"
New-ItemProperty -Path $rPath -Name $rVersion -PropertyType DWord -Value $rValue -Force -ErrorAction SilentlyContinue | Out-Null
Write-Output "$rpath exists`t"
New-ItemProperty -Path $rPath -Name $rVersionInfo -PropertyType String -Value $rInfoValue -Force -ErrorAction SilentlyContinue | Out-Null
Write-Output "$rVersion = $rvalue, $rVersionInfo = $rInfoValue and $rVersionWindows = $rWindows`t"
#Win10 home bypass
New-ItemProperty -Path $rPath -Name $rBlock -PropertyType DWord -Value $rValue -Force -ErrorAction SilentlyContinue | Out-Null
}
catch
{
$Exception = $error[0].Exception.Message + "`nAt Line " + $error[0].InvocationInfo.ScriptLineNumber
Write-Error $Exception
#Exit 90 # could not write registry setting, continue with upgrade, default is to latest version
}
function Start-Win10UpgradeWUA
{
<#
.SYNOPSIS
This function downloads the Windows update assistant tool and runs it silently.
.NOTES
Version: 1.0
Author: Andy Escolastico
Creation Date: 05/10/2020
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[Boolean] $Reboot = $true,
#THIS FLAG DOES NOT WORK FOR THIS FUNCTION
[Parameter(Mandatory = $false)]
[String] $DLPath = (Get-Location).Path,
[Parameter(Mandatory = $false)]
[String] $LogPath = (Get-Location).Path
)
New-Item -Path "C:\" -Name "Win10UpgradeTemp" -ItemType "Directory" -Force
New-Item -Path "C:\Win10UpgradeTemp" -Name "Logs" -ItemType "Directory" -Force
$DLPath = "C:\Win10UpgradeTemp"
$LogPath = "C:\Win10UpgradeTemp\Logs"
if (!(Test-Path -Path $DLPath))
{
$null = New-Item -ItemType directory -Path $DLPath -Force
}
if (!(Test-Path -Path $LogPath))
{
$null = New-Item -ItemType directory -Path $LogPath -Force
}
$DLLink = "https://go.microsoft.com/fwlink/?LinkID=799445"
$PackagePath = "$DLPath\Win10_WUA.exe"
$LogPath = "$LogPath\Win10_WUA.log"
Remove-Item -Path "$PackagePath" -Force -Recurse
Remove-Item -Path "$LogPath " -Force -Recurse
(New-Object System.Net.WebClient).DownloadFile($DLLink, "$PackagePath")
Start-Sleep -s 20
Write-Host "The Upgrade will commence shortly. Your PC will be rebooted. Please save any work you do not want to lose."
if ($Reboot -eq $true)
{
Invoke-Expression "$PackagePath /copylogs $LogPath /auto upgrade /dynamicupdate /compat ignorewarning enable /skipeula /quietinstall"
}
else
{
Invoke-Expression "$PackagePath /copylogs $LogPath /auto upgrade /dynamicupdate /compat ignorewarning enable /skipeula /quietinstall"
}
}
Start-Win10UpgradeWUA
User Notifications:
Ensure that you have Automatic Reboot disabled for the worklet, as shown here:
Windows Update Assistant uses its own embedded notifications and reboot processes, so turning off the native worklet reboot and notification settings is required for the Feature Build to stage correctly.
Note: If you want to fully automate the reboot after the upgrade, you can remove the /NoReboot /NoRestartUI /NoRestart arguments from the remediation code.
When the worklet runs, you will see a temp directory staged under C:\Win10UpgradeTemp, as shown here:
This is where the Windows Update Assistant files cache prior to execution. It also includes a Log file that you can use for troubleshooting. The Log file is generated after the entire upgrade process completes, so you will not see anything within this folder until after the upgrade is finished.
The upgrade itself can take up to 40-60 minutes to run depending on the device's bandwidth, internet speeds, and the current Windows build version the device is on. (For example: a device on build 1803 will take longer to upgrade than a device on 21H1 since it does not need to download and install the prerequisite enablement packages behind the scenes).
While the upgrade is staging, you'll be able to see a background process for it within task manager:
When the staging completes, a process for Windows 10 Setup and Windows Installer begins:
The installer begins extracting the feature update files to the $GetCurrent and $WINDOWS.~BT folders:
The $WINDOWS.~BT folder increases in size as the Feature Update downloads and extracts its necessary cab files:
Example: An upgrade from a 1903 device to 21H2 took about 60 minutes to complete. The total completed file size of the $WINDOWS.~BT folder was just under 18 GB.
When the update finishes downloading and staging, Automox shows the update as pending a reboot:
The reboot should take place automatically when the Feature Upgrade is fully staged:
On the next reboot, the device finalizes the Feature Upgrade:
After the upgrade completes, the user will see the following screen on their first sign on:
Notes:
Only builds 1803 or later will upgrade using this method. Earlier build versions (1709 or earlier) will require an in-place ISO upgrade to the desired Feature Build.
Comments
0 comments
Article is closed for comments.