Decline Windows 11 upgrade

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).

reg add HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /f /v SvOfferDeclined /t REG_QWORD /d 1

Other items that may help prevent unintended upgrades:

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
1 Like

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
}

Since this has become a hot topic again, here’s a few updates and corrections:

Import-Module $env:SyncroModule
## REQUIRES Syncro dropdown variable "mode" with "block" (default) and "unblock"
## REQUIRES Syncro dropdown variable "TargetVersion" with "21H1", "21H2", etc.

if ($mode -eq "block"){

	# limit the Target Version (e.g. 22H2)
	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

    # prevent upgrade offer from displaying
    reg add HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /f /v SvOfferDeclined /t REG_QWORD /d 1

	# Other possible prevention
    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
	Start-Process -FilePath msiexec.exe -ArgumentList "/x {6798C408-2636-448C-8AC6-F4E341102D27} /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 "Target Version"
    reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v TargetReleaseVersion
    reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v TargetReleaseVersionInfo
	
	# Undo prevent upgrade offer from displaying
    reg delete HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /f /v SvOfferDeclined

    # 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
}

1 Like

How do I determine if I should use 21H21 or 21H2?

21H1 is EOL, You want 21H2 or 22H2. I’ve haven’t seen any reason not to be on 22H2

Thanks!
Minmum20 characters

1 Like

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”.

The values of those variables will then be as specified, “block” or “unblock” and the target version of Windows 10 you want, e.g. “21H2” or “22H2”.

Does that help?