So it looks like the jerks at Microsoft aren’t offering 21H2 if the machine is Windows 11 capable. You have to go into WU and click ‘Stay on Windows 10 for now’ and then it finds 21H2.
This seems to work to decline (actual value seems to vary but just using 1 seems to be fine). Also gets rid of the tray icon prompt (probably will need to reboot or check for Windows Updates for registry change to be noticed).
Thanks @isaacg. Here is a script cobbled together with block and unblock options. This should make it easy to schedule with defaults and for the techs to run manually if they need to unblock. I like to have Install and Uninstall in the same scripts now that my list of scripts is getting long.
Import-Module $env:SyncroModule
## Add Syncro dropdown variable "mode" with "block" (default) and "unblock" options
## Add Syncro dropdown variable "TargetVersion" with "21H1", "21H2", etc. options
if ($mode -eq "block"){
reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v TargetReleaseVersion /t REG_DWORD /d 1
reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v TargetReleaseVersionInfo /t REG_SZ /d $TargetVersion
reg add HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /f /v SvOfferDeclined /t REG_QWORD /d 1
reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v DisableOSUpgrade /t REG_DWORD /d 1
reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v ProductVersion /t REG_DWORD /d 10
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade /f /v AllowOSUpgrade /t REG_DWORD /d 0
reg add HKLM\SOFTWARE\Policies\Microsoft\WindowsStore /f /v DisableOSUpgrade /t REG_DWORD /d 1
reg add HKLM\SYSTEM\Setup\UpgradeNotification /f /v UpgradeAvailable /t REG_DWORD /d 0
# Uninstall Windows PC Health Check
Start-Process -FilePath msiexec.exe -ArgumentList "/x {B1E7D0FD-7CFE-4E0C-A5DA-0F676499DB91} /qn" -Wait
# Prevent Windows PC Health Check install
reg add HKLM\SOFTWARE\Microsoft\PCHC /f /v PreviousUninstall /t REG_DWORD /d 1
}
if ($mode -eq "unblock") {
# Undo Set Windows to not upgrade past 21H2 (prevent Windows 11 auto-upgrade)
reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v TargetReleaseVersion
reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v TargetReleaseVersionInfo
# Undo Other possible prevention
reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v DisableOSUpgrade
reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v ProductVersion
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade /f /v AllowOSUpgrade
reg delete HKLM\SOFTWARE\Policies\Microsoft\WindowsStore /f /v DisableOSUpgrade
reg delete HKLM\SYSTEM\Setup\UpgradeNotification /f /v UpgradeAvailable
# Undo Prevent Windows PC Health Check install
reg delete HKLM\SOFTWARE\Microsoft\PCHC /f /v PreviousUninstall
}
Thanks for posting this. I’m a bit confused with the variable. I need to use this script, and create 2 variables? I’m kinda new here; can you walk me through it? Thanks in advance!!
The script was written to give you the option of choosing your target build of Windows 10, e.g. if you have some reason to stop updates at a previous version like 21H2. The other variable allows the script to block the upgrade to Windows 11 or unblock it whenever you decide you want the upgrade to proceed. [For example, I just had a client last month who finally decided to upgrade to Windows 10 from 7 and couldn’t because I had blocked it years ago!]
So to use this script, create a new script in Syncro, copy and paste the code, then create runtime variables for “mode” and “TargetVersion”.