Skip to content

Instantly share code, notes, and snippets.

@MuntashirAkon
Created May 14, 2025 21:34
Show Gist options
  • Save MuntashirAkon/d436af26cf7a52f3c2d852862cfb3b1b to your computer and use it in GitHub Desktop.
Save MuntashirAkon/d436af26cf7a52f3c2d852862cfb3b1b to your computer and use it in GitHub Desktop.
Restrict Window 11 version to the current Windows version to prevent any major updates (which often break stuffs). Security and quality updates will still be provided.
# Get current Windows DisplayVersion (e.g., 24H2)
$CurrentVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").DisplayVersion
# Define the target registry path
$RegPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
# Create the registry key if it does not exist
if (-not (Test-Path $RegPath)) {
New-Item -Path $RegPath -Force | Out-Null
}
# Set the required registry values
Set-ItemProperty -Path $RegPath -Name "ProductVersion" -Value "Windows 11" -Type String
Set-ItemProperty -Path $RegPath -Name "TargetReleaseVersion" -Value 1 -Type DWord
Set-ItemProperty -Path $RegPath -Name "TargetReleaseVersionInfo" -Value $CurrentVersion -Type String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment