2023‐11 PowerShell's PSWindowsUpdate module and unexpected upgrade to Windows 11 - najki78/publicStuff GitHub Wiki

Several of our Windows 10 machines that we are updating using great PowerShell's PSWindowsUpdate module by Michal Gajda (using Install-WindowsUpdate -AcceptAll -IgnoreReboot) unexpectedly upgraded to Windows 11.

This happened even though we have configured Intune to prevent the upgrade (in 'Update rings for Windows 10 and later', these devices have 'Upgrade Windows 10 devices to Latest Windows 11 release:' configured as 'No').

While chatting with Michal, he recommended to set maximum Target version for Feature updates, since his module is using built-in Windows Update API and uses Windows Update settings on the machine.

To avoid this unwanted upgrade, you can use a registry change that sets the target version for feature updates to Windows 10 22H2. This will override the Windows Update settings and prevent PSWindowsUpdate from installing Windows 11. The registry keys you need to add are:

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 22H2

reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f /v ProductVersion /t REG_SZ /d "Windows 10"

(I have tested, Intune's 'Feature updates for Windows 10 and later' but I have not found it reliable in stopping upgrade to Win 11)