How to Enable Automatic Windows 11 Upgrade Using a Custom PowerShell Script

Key Points

  • Streamline OS Upgrades: Use a custom PowerShell script to automate enabling the Windows 11 upgrade offer on Windows 10 devices, saving IT teams and MSPs hours of manual work.
  • Bypass Upgrade Blocks: This script removes the TargetReleaseVersionTargetReleaseVersionInfo, and SvOfferDeclined registry keys to eliminate version locks and reenable upgrade prompts.
  • Admin Rights Required: The script checks for administrator privileges before execution to ensure secure system changes.
  • Risk Awareness: Registry edits carry risks; test in a controlled environment, maintain system backups, and verify Windows 11 compatibility before broad rollout.
  • Efficiency Over Manual Methods: It automates a process that would otherwise require time-consuming GUI navigation or manual registry edits.
  • Part of a Complete Upgrade Workflow: This script is best paired with Windows 11 compatibility checks, direct upgrade scripts, and automated update scheduling for seamless OS transitions.

With the advent of Windows 11, enabling its upgrade became a primary focus for IT professionals. Understanding and managing operating system (OS) transitions is crucial in the IT sector, especially as businesses work to remain compatible with the latest technologies. The script in focus offers a streamlined way to enable the automatic upgrade to the Windows 11 upgrade.

Background

The script’s purpose is straightforward: it enables the upgrade to Windows 11. Specifically tailored for the Windows 10 OS architecture, its primary aim is to trigger the upgrade offer for Windows 11 to users. This is pivotal for IT professionals and managed service providers (MSPs) to ensure that end-users receive timely upgrades without hitches. By maintaining system compatibility and leveraging the latest features, businesses can guarantee optimal performance and security.

The Script


<#
.SYNOPSIS
    Enables Windows 11 upgrade.
.DESCRIPTION
    Enables Windows 11 upgrade.
.EXAMPLE
    No parameters needed
    Enables Windows 11 upgrade.
.OUTPUTS
    None
.NOTES
    Minimum OS Architecture Supported: Windows 10
    Release Notes:
    Allows the upgrade offer to Windows 11 to appear to users
    (c) 2023 NinjaOne
    By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https://www.ninjaone.com/terms-of-use.
    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. 
    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. 
    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. 
    Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. 
    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. 
    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. 
    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).
#>
[CmdletBinding()]
param ()

begin {
    function Test-IsElevated {
        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
        $p = New-Object System.Security.Principal.WindowsPrincipal($id)
        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
    }
}
process {
    if (-not (Test-IsElevated)) {
        Write-Error -Message "Access Denied. Please run with Administrator privileges."
        exit 1
    }

    $Splat = @{
        Path        = "HKLM:SOFTWAREPoliciesMicrosoftWindowsWindowsUpdate"
        Name        = @("TargetReleaseVersion", "TargetReleaseVersionInfo")
        ErrorAction = "SilentlyContinue"
    }

    Remove-ItemProperty @Splat -Force
    Remove-ItemProperty -Path "HKLM:SOFTWAREMicrosoftWindowsUpdateUXSettings" -Name "SvOfferDeclined" -Force -ErrorAction SilentlyContinue
    $TargetResult = Get-ItemProperty @Splat
    $OfferResult = Get-ItemProperty -Path "HKLM:SOFTWAREMicrosoftWindowsUpdateUXSettings" -Name "SvOfferDeclined" -ErrorAction SilentlyContinue
    if ($null -ne $TargetResult -or $null -ne $OfferResult) {
        Write-Host "Failed to enable Windows 11 Upgrade."
        exit 1
    }
    exit 0
}
end {}

 

Access 300+ scripts in the NinjaOne Dojo

Get Access

Script Detailed Breakdown

Preparation Phase

The script starts with a CmdletBinding attribute, commonly used for advanced functions in PowerShell. It doesn’t require any parameters.

The script then checks if the user running the script has administrative rights with the Test-IsElevated function.

Execution Phase

If the user doesn’t have administrative rights, an error message is thrown.

The script defines a variable $Splat, which holds information related to the Windows Update registry path and some properties.

It then attempts to remove certain registry properties related to the Windows update using the Remove-ItemProperty command, effectively clearing potential blocks or specific target versions that may prevent the upgrade.

Finally, the script checks whether these registry properties were successfully removed. If they were not, it signals a failure in enabling the upgrade.

Completion Phase

The script exits with a status code. A zero (0) indicates successful completion, while a one (1) signifies an error.

Potential Use Cases

Imagine an IT professional, George, working for a medium-sized enterprise. The company decides to transition to Windows 11 to leverage its new features. George, tasked with ensuring a smooth transition, utilizes this script to batch-enable the upgrade across all systems, saving significant manual work.

Alternative Approach

Traditional methods of enabling Windows 11 upgrades might involve manual changes in system settings or using GUI-based tools, which are time-consuming and prone to errors. This script automates the process, making it more efficient and error-resistant.

Implications

While the script offers a way to enable the Windows 11 upgrade seamlessly, any automated process comes with risks. Altering registry settings can have unintended consequences. IT professionals must ensure they

  • have backup strategies in place,
  • test the script in controlled environments, and
  • always prioritize IT security.

You can check out our other articles to learn

Safeguard your data with NinjaOne’s backup software.

Schedule your 14-day free trial today!

Recommendations

  • Always backup critical data and system settings before running scripts.
  • Test the script on a small sample of machines before broad deployment.
  • Ensure users are informed about upgrades to prevent surprises.

Final Thoughts

Transitioning to new OS versions can be daunting. Using tools and scripts like the one discussed can ease the process. Furthermore, NinjaOne can further assist in managing such transitions, offering monitoring and automation capabilities that are invaluable in today’s rapidly evolving IT landscape.

Add a Comment

Your email address will not be published. Required fields are marked *

FAQs

No. The Windows OS upgrade won’t occur without your consent. Downloading and installing Windows 11 will require manual intervention even after your device is deemed compatible for this upgrade. Even so, it’s important to note that Windows 10 support will end on October 14, 2025.

No. This script only enables the upgrade offer in Windows Update by removing upgrade-blocking settings. The actual installation process still requires user confirmation or additional automation tools.

The script checks for admin rights, deletes registry entries that block the upgrade, and reenables the Windows 11 offer. It automates a process that would otherwise require manual registry edits or GUI changes.

Yes. The script will not run unless it detects administrator privileges as editing the Windows registry requires elevated permissions.

It’s generally safe if you test it in a controlled environment, create system backups beforehand, and verify Windows 11 compatibility. However, modifying registry settings always carries some risk.

Manual upgrades require navigating system settings or registry edits on each device. This script automates the process, reduces errors, and allows batch execution across multiple endpoints.

Next Steps

Building an efficient and effective IT team requires a centralized solution that acts as your core service delivery tool. NinjaOne enables IT teams to monitor, manage, secure, and support all their devices, wherever they are, without the need for complex on-premises infrastructure.

Learn more about NinjaOne Remote Script Deployment, check out a live tour, or start your free trial of the NinjaOne platform.

Categories:

You might also like