Windows Feature Update - Registry Worklet

Windows Feature Update - Registry Worklet

Over time, Windows Feature Versions will be updated. With this worklet, you can set the targeted version of the Feature Update that you want your hosts to be on, and Automox can take care of the rest through the normal patching process!

Important Notes

Notice 1:

This worklet sets the registry key to target the specific Feature Update version set in the code. This registry key remains on the device unless either of these things are true:

1. You update the Feature Update version key to a new version by running the Worklet again with updated values to reflect the new intended target version.

OR

2. You manually remove the registry value or set it back to default settings with a supplementary worklet or directly on the host.

 

Notice 2:

After running the worklet, if you do not see the Feature Update as available to patch in the Automox console, there are a few things to consider:

  • The Feature Update only shows as available if all prerequisite patches have been installed. It is recommended to get the device fully updated with all available patches in order to ensure that all pre-reqs have been installed.
  • If all patches available to the device have been installed and the Feature Update is still not showing up, it might be that the host needs to be step-up installed.
    • This typically means the previous Feature Update contains the prerequisites for the build that you are on, rather than the other patches.
    • As an example, let's say you were on 20H1 trying to get to 21H2. You might need to first set the targeted version to 20H2, then 21H1, and then 21H2.
  • If you are still unable to see the Feature Update in the Automox console as an available patch for the host after completing the above recommendations, please contact support so that we can take a look.

Steps to resolution

In order to get started, navigate to the Manage > Policies tab, and select Create Policy. You will set up a new Worklet for this.

EVALUATION Code:

Note Line  4: This is where you set the intended version of the Feature Release that you want on your hosts. In this example, 22H2 is designated.

#Evaluation Script - Determine if Target Release Version Registry keys exist and are set# Define Values in this section and ensure they match the values set in the remediation script
#############################################
$rValue = '1' #Enable Target Release Version 0 = Disabled, 1 = Enabled
$rInfoValue = '22H2' #Specify Windows 10 Target Release Version. Select the preferred version from https://docs.microsoft.com/en-us/windows/release-information/
##############################################Predefined variables
$rPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate'
$rVersion = 'TargetReleaseVersion'
$rVersionInfo = 'TargetReleaseVersionInfo'#Check if $rVersion registry value missing
try{
  $cVersion = Get-ItemPropertyValue -Path $rPath -Name $rVersion -ErrorAction Stop
  $cVersionInfo = Get-ItemPropertyValue -Path $rPath -Name $rVersionInfo -ErrorAction Stop
}
catch{
  Write-Error "Unable to read registry values"
  Exit -1
}#Check if registry value data matches defined values
if (($cVersion -eq $rValue) -and ($rInfoValue -eq $cVersionInfo)) {
  Exit 0
} else { Exit -1 }

 

REMEDIATION Code:

Note Line 14: This is where you set the intended version of the Feature Release that you would like on your hosts. In this example, 22H2 is designated. The value must be set to the same value as the evaluation code in order to function as intended.

<#
.SYNOPSIS
Configure Windows 10 Target Release Version.DESCRIPTION
Uses group policy registry keys to Enable and configure Target Release Version for Windows 10.Target Release Version
Enable = 1 or Disable = 0Target Release Version Info
Specify the preferred version of Windows 10. Enter version from https://docs.microsoft.com/en-us/windows/release-information/.NOTES
Author: Automox
Please note, these settings remain in the registry, and would require modification or removal to change or revert back to default..PREREQUISITES
Windows 10 1803 or higher
Manageable SKU (Pro, Education, Enterprise, Business)
#># Define Values in this section
#############################################
$rValue = '1' #Enable Target Release Version 0 = Disabled, 1 = Enabled
$rInfoValue = '22H2' #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'
try {
if(-not(Test-Path -path $rPath)){
New-Item -Path $rPath -Force -ErrorAction Stop | Out-Null
}
Write-Output "SUCCESS: Target Release Version keys set`t"
New-ItemProperty -Path $rPath -Name $rVersion -PropertyType DWord -Value $rValue -Force -ErrorAction Stop | Out-Null
Write-Output "$rpath exists`t"
New-ItemProperty -Path $rPath -Name $rVersionInfo -PropertyType String -Value $rInfoValue -Force -ErrorAction Stop | Out-Null
New-ItemProperty -Path $rPath -Name $rVersionWindows -PropertyType String -Value $rWindows -Force -ErrorAction Stop | Out-Null
Write-Output "$rVersion = $rvalue and $rVersionInfo = $rInfoValue`t" Exit 0
} catch { $Exception = $error[0].Exception.Message + "`nAt Line " + $error[0].InvocationInfo.ScriptLineNumber
Write-Error $Exception
Exit 90
}
Was this article helpful?
1 out of 1 found this helpful