I have a script available to prevent Windows 11 Update, but I wanted to see if I could refine it.
Below is the current script I've created
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /v TargetReleaseversion /t REG_DWORD /d 1reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /v TargetReleaseversionInfo /t REG_SZ /d 22H2
The reason being is that I'm going to deploy the script via N-Able RMM to many machines and a majority of them are using different versions of Windows 10 OS, also, I believe a couple may be Windows 7, so the script isn't necessary for them.
Is there a way to create a powershell script that can identify the Windows version, and if it's 2004-22H2, it'll add the necessary registry keys? For Example, if the Windows Version is 21H2 the script would apply the following registry key
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /v TargetReleaseversionInfo /t REG_SZ /d 21H2