A production-ready automation tool for seamlessly upgrading Windows 11 from 24H2 to 25H2 via official enablement package (KB5054156)
Windows 11 25H2 Update Script is a robust, enterprise-grade automation solution designed to streamline the upgrade process from Windows 11 24H2 to 25H2. It supports both PowerShell and Batch file execution, automatically detects system architecture, validates digital signatures, and manages the complete upgrade workflow with comprehensive error handling and logging.
# Clone and install
git clone https://github.com/paulmann/Windows-11-25H2-Update-Script.git
cd Windows-11-25H2-Update-Script
# Run as Administrator
.\Upgrade-Win11-To-25H2.ps1
# With custom parameters
.\Upgrade-Win11-To-25H2.ps1 -ForceReboot -RetryCount 5
# One-time bypass execution policy
powershell.exe -ExecutionPolicy Bypass -File ".\Upgrade-Win11-To-25H2.ps1"# Download and run (Administrator required)
curl -L -o Upgrade-Win11-To-25H2.bat "https://github.com/paulmann/Windows-11-25H2-Update-Script/raw/main/Upgrade-Win11-To-25H2.bat"
Upgrade-Win11-To-25H2.bat
# Or run from repository
git clone https://github.com/paulmann/Windows-11-25H2-Update-Script.git
cd Windows-11-25H2-Update-Script
Upgrade-Win11-To-25H2.bat- π Why Windows 11 25H2?
- β¨ Key Features
- π Installation & Usage
- ποΈ Advanced Features
- π DevOps Integration
- π’ Enterprise Usage
- π Troubleshooting
- π€ Contributing
- π License
- π¨βπ» Author & Support
- π― Roadmap
Windows 11 25H2 uses the enablement package (eKB) technology, making the upgrade process incredibly efficient:
# Traditional feature update: 3-5 GB download, 30+ minutes
# Enablement package: ~50 KB download, 1-2 minutes!
# Features are pre-staged in 24H2, just activated by eKB
Target Build: 26200.6718 (from 26100.5074+)
Package: KB5054156- β‘ Lightning Fast: Upgrade completes in under 2 minutes with just a restart
- π¦ Minimal Download: Tiny enablement package vs. multi-GB traditional updates
- π Shared Servicing: Uses same servicing branch as 24H2 for compatibility
- π‘οΈ Production Ready: Leverages Microsoft's proven eKB technology
- π Extended Support: Fresh 24-36 month support lifecycle begins
- Administrator Validation: Automatic privilege checking with clear error messages
- Digital Signature Verification: Validates MSU package authenticity (PowerShell only)
- System Compatibility: Comprehensive build version and architecture checks
- Rollback Protection: Safe failure handling with detailed error reporting
- Architecture Detection: Automatic x64/ARM64 detection with fallback prompts
- Version Checking: Smart detection of current build and upgrade requirements
- Download Optimization: BITS service with HTTP fallback and retry logic
- Installation Control: Silent installation with configurable reboot behavior
- Detailed Logging: Full transcript logging for audit and troubleshooting
- Progress Tracking: Real-time status updates with color-coded messages
- Error Classification: Structured error handling with resolution suggestions
- Exit Code Management: Standard exit codes for automated deployment
- PowerShell Version: Full-featured with advanced error handling and logging
- Batch Version: Simplified alternative that works without ExecutionPolicy changes
- Cross-Platform: Both versions support x64 and ARM64 architectures
- Deployment Ready: Perfect for Group Policy, SCCM, or manual execution
- Operating System: Windows 11, version 24H2 (Build 26100.5074 or later)
- Architecture: x64 (AMD64) or ARM64
- Privileges: Administrator rights required
- Network: Internet connection for package download
- PowerShell: Version 5.1+ (for PowerShell script)
- Execution Policy: RemoteSigned or Unrestricted (for PowerShell script)
# Clone repository
git clone https://github.com/paulmann/Windows-11-25H2-Update-Script.git
cd Windows-11-25H2-Update-Script
# Choose your preferred version:
# PowerShell: .\Upgrade-Win11-To-25H2.ps1
# Batch: .\Upgrade-Win11-To-25H2.bat# PowerShell version
$url = 'https://github.com/paulmann/Windows-11-25H2-Update-Script/raw/main/Upgrade-Win11-To-25H2.ps1'
Invoke-WebRequest -Uri $url -OutFile 'Upgrade-Win11-To-25H2.ps1'
# Batch version
$url = 'https://github.com/paulmann/Windows-11-25H2-Update-Script/raw/main/Upgrade-Win11-To-25H2.bat'
Invoke-WebRequest -Uri $url -OutFile 'Upgrade-Win11-To-25H2.bat'# Using PowerShell Gallery (future)
# Install-Script -Name Windows11-25H2-Update
# Using Chocolatey (future)
# choco install windows11-25h2-updateThis script MUST be run as Administrator. Right-click PowerShell and select Run as Administrator, or use:
# Start PowerShell as Administrator
powershell.exe -Command "Start-Process PowerShell -Verb RunAs"If you encounter "execution of scripts is disabled on this system":
# One-time bypass (recommended)
powershell.exe -ExecutionPolicy Bypass -File ".\Upgrade-Win11-To-25H2.ps1"
# Set for current user
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
# Temporary session policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope ProcessThe batch file MUST also run as Administrator:
# Right-click on batch file β "Run as administrator"
# Or from Administrator Command Prompt:
cd /d "C:\path\to\script"
Upgrade-Win11-To-25H2.bat- β No ExecutionPolicy issues - works out of the box
- β Simpler deployment - single .bat file
- β Universal compatibility - works on any Windows system
- β Group Policy friendly - easier to deploy via GPO
- β No signature validation - less security verification
- β Simpler error handling - basic error reporting
# Basic usage with default settings
.\Upgrade-Win11-To-25H2.ps1
# Force immediate reboot after installation
.\Upgrade-Win11-To-25H2.ps1 -ForceReboot
# Suppress reboot (manual reboot required later)
.\Upgrade-Win11-To-25H2.ps1 -NoRestart
# Custom retry settings for unstable networks
.\Upgrade-Win11-To-25H2.ps1 -RetryCount 10 -RetryDelaySec 30
# One-time execution with bypass
powershell.exe -ExecutionPolicy Bypass -File ".\Upgrade-Win11-To-25H2.ps1" -ForceRebootREM Basic usage
Upgrade-Win11-To-25H2.bat
REM The batch version automatically handles:
REM - Architecture detection
REM - Download with retry logic
REM - Installation with progress display
REM - Reboot prompting| Feature | PowerShell Version | Batch Version |
|---|---|---|
| Reboot Control | -Reboot, -ForceReboot, -NoRestart |
Interactive prompt |
| Retry Logic | -RetryCount, -RetryDelaySec |
Fixed (3 attempts, 5s delay) |
| Logging | Full transcript logging | Console output only |
| Signature Check | Yes (Get-AuthenticodeSignature) | No |
| Error Handling | Detailed with recommendations | Basic with codes |
| ExecutionPolicy | Required setup | Not applicable |
Both scripts automatically detect your system architecture:
# Automatic detection logic
if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") {
$downloadUrl = $x64Url
} elseif ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") {
$downloadUrl = $arm64Url
} else {
# Fallback to user prompt (PowerShell only)
Write-Host "Unable to detect architecture automatically"
$choice = Read-Host "Specify architecture (AMD64/ARM64) [Default: AMD64]"
}Supported URLs:
- x64: KB5054156 for AMD64 architecture
- ARM64: KB5054156 for ARM64 architecture (Surface Pro X, etc.)
PowerShell version includes comprehensive signature validation:
# Signature validation process
$signature = Get-AuthenticodeSignature -FilePath $msuFile
# Verify signature status
if ($signature.Status -ne 'Valid') {
throw "Invalid signature status: $($signature.Status)"
}
# Verify Microsoft as signer
if ($signature.SignerCertificate.Subject -notmatch 'Microsoft Corporation') {
throw "Untrusted signer: $($signature.SignerCertificate.Subject)"
}Robust download handling with configurable retry:
# PowerShell retry logic
for ($attempt = 1; $attempt -le $RetryCount; $attempt++) {
try {
# Try BITS first, fallback to HTTP
if (Get-Service -Name BITS -ErrorAction SilentlyContinue) {
Start-BitsTransfer -Source $Uri -Destination $OutFile
} else {
Invoke-WebRequest -Uri $Uri -OutFile $OutFile -UseBasicParsing
}
break
}
catch {
if ($attempt -lt $RetryCount) {
Start-Sleep -Seconds $RetryDelaySec
} else {
throw "Failed after $RetryCount attempts"
}
}
}PowerShell Logging:
# Comprehensive logging location
$logPath = "C:\ProgramData\Win11-25H2\Upgrade_20251001_142530.log"
# Log levels: Info, Warning, Error, Success
Write-Log "Starting Windows 11 25H2 upgrade process" -Level Info
Write-Log "Administrator privileges confirmed" -Level Success
Write-Log "Retrying download in 5 seconds..." -Level Warning
Write-Log "Installation failed with exit code 2359302" -Level ErrorBatch Logging:
REM Basic console output with timestamps
echo [2025-10-01 14:25:30] [INFO] Starting update process
echo [2025-10-01 14:25:31] [SUCCESS] Administrator privileges confirmed
echo [2025-10-01 14:25:45] [WARNING] Download failed, retrying...
echo [2025-10-01 14:26:15] [SUCCESS] Installation completed successfullyname: Deploy Windows 11 25H2 Update
on:
schedule:
- cron: '0 2 * * 1' # Weekly on Monday 2 AM
workflow_dispatch:
jobs:
deploy-update:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Deploy PowerShell Version
run: |
powershell.exe -ExecutionPolicy Bypass -File ".\Upgrade-Win11-To-25H2.ps1" -NoRestart
shell: cmd
- name: Deploy Batch Version (Alternative)
run: |
.\Upgrade-Win11-To-25H2.bat
shell: cmdtrigger:
branches:
include:
- main
pool:
name: 'Windows-Agents'
steps:
- powershell: |
.\Upgrade-Win11-To-25H2.ps1 -RetryCount 5 -RetryDelaySec 10
displayName: 'Upgrade to Windows 11 25H2'
- script: |
if errorlevel 3010 (
echo Reboot required - scheduling maintenance window
)
displayName: 'Handle Reboot Requirements'Create a Group Policy Object (GPO) for mass deployment:
# PowerShell script deployment via GPO
# Computer Configuration β Policies β Windows Settings β Scripts (Startup/Shutdown)
# Add: powershell.exe -ExecutionPolicy Bypass -File "\\domain\sysvol\scripts\Upgrade-Win11-To-25H2.ps1"
# Batch file deployment via GPO (simpler)
# Computer Configuration β Policies β Windows Settings β Scripts (Startup/Shutdown)
# Add: \\domain\sysvol\scripts\Upgrade-Win11-To-25H2.batApplication Deployment:
REM Detection Method
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuild | find "26200"
REM Installation Command (PowerShell)
powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File ".\Upgrade-Win11-To-25H2.ps1" -NoRestart
REM Installation Command (Batch - Recommended for SCCM)
Upgrade-Win11-To-25H2.bat
REM Return Codes
REM 0 = Success
REM 3010 = Success, reboot required
REM 1 = FailureConfiguration Windows11_25H2_Update {
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node "localhost" {
Script UpdateWindows11 {
SetScript = {
& "C:\Scripts\Upgrade-Win11-To-25H2.ps1" -NoRestart
}
TestScript = {
$build = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild
return [int]$build -ge 26200
}
GetScript = {
return @{ Result = "Windows 11 25H2 Update Status" }
}
}
}
}# Package the batch file for Intune deployment
# Create intunewin file with Microsoft Win32 Content Prep Tool
# Install command
cmd /c "Upgrade-Win11-To-25H2.bat"
# Detection rule
if ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild -ge 26200) {
Write-Output "Installed"
exit 0
} else {
exit 1
}
# Return codes
# 0 = Success
# 3010 = Success (reboot required)
# Other = Failure<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2">
<Triggers>
<CalendarTrigger>
<StartBoundary>2025-10-01T02:00:00</StartBoundary>
<ScheduleByWeek>
<WeeksInterval>1</WeeksInterval>
<DaysOfWeek>
<Monday />
</DaysOfWeek>
</ScheduleByWeek>
</CalendarTrigger>
</Triggers>
<Actions>
<Exec>
<Command>C:\Scripts\Upgrade-Win11-To-25H2.bat</Command>
</Exec>
</Actions>
<Principals>
<Principal>
<UserId>S-1-5-18</UserId> <!-- SYSTEM account -->
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
</Task># PowerShell version writes to Application log
Write-EventLog -LogName Application -Source "Windows11Update" -EventId 1000 -Message "Upgrade started"
# Check upgrade status across domain
Get-ADComputer -Filter * | ForEach-Object {
$build = Invoke-Command -ComputerName $_.Name -ScriptBlock {
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuild
} -ErrorAction SilentlyContinue
[PSCustomObject]@{
ComputerName = $_.Name
CurrentBuild = $build
Is25H2 = [int]$build -ge 26200
}
} | Export-Csv "Windows11_25H2_Status.csv"REM Problem: "Access denied" or "Administrator privileges required"
REM Solution: Always run as Administrator
REM Check current privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: Administrator privileges required
echo Right-click and select "Run as administrator"
pause
exit /b 1
)# Problem: "cannot be loaded because running scripts is disabled"
# Solution: Use one-time bypass or adjust policy
# Quick fix - one-time bypass
powershell.exe -ExecutionPolicy Bypass -File ".\Upgrade-Win11-To-25H2.ps1"
# Permanent fix for current user
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
# Check current policy
Get-ExecutionPolicy -List# Problem: Network issues, proxy, or firewall blocking
# Solutions:
# 1. Check internet connectivity
Test-NetConnection -ComputerName catalog.sf.dl.delivery.mp.microsoft.com -Port 443
# 2. Configure proxy (if needed)
netsh winhttp set proxy proxy-server:8080
# 3. Temporarily disable antivirus/firewall
# 4. Use batch version (simpler HTTP handling)# Problem: "Unsupported Windows version"
# Check current build
$build = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion")
Write-Host "Current Build: $($build.CurrentBuild).$($build.UBR)"
# Requirements:
# Minimum: 26100.5074 (Windows 11 24H2)
# Target: 26200.6718 (Windows 11 25H2)
# Solution: Update to 24H2 first via Windows Update| Exit Code | PowerShell | Batch | Description | Solution |
|---|---|---|---|---|
| 0 | β Success | β Success | Installation completed | No action needed |
| 3010 | β Success, reboot required | β Success, reboot required | Installation successful | Reboot system |
| 1 | β General failure | β General failure | Various errors | Check logs |
| 2359302 | β Update not applicable | β Update not applicable | Already installed or incompatible | Verify system version |
| 2359303 | β Installation in progress | β Installation in progress | Another update running | Wait and retry |
| 2147943458 | β Access denied | β Access denied | Insufficient privileges | Run as Administrator |
# System Information
winver # GUI version info
systeminfo | find "OS Version" # Command line version info
Get-ComputerInfo | Select WindowsVersion, WindowsEditionId
# Registry Check
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuild
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v UBR
# Architecture Check
echo %PROCESSOR_ARCHITECTURE% # CMD
$env:PROCESSOR_ARCHITECTURE # PowerShell
# Download Test
ping catalog.sf.dl.delivery.mp.microsoft.com
nslookup catalog.sf.dl.delivery.mp.microsoft.com
# Service Status
sc query BITS # BITS service status
sc query wuauserv # Windows Update serviceWe welcome contributions! Here's how to get involved:
# Fork and clone the repository
git clone https://github.com/yourusername/Windows-11-25H2-Update-Script.git
cd Windows-11-25H2-Update-Script
# Test both versions
# PowerShell testing
powershell.exe -ExecutionPolicy Bypass -File ".\Upgrade-Win11-To-25H2.ps1" -WhatIf
# Batch testing in test environment
.\Upgrade-Win11-To-25H2.bat- Fork the repository
- Create a feature branch (
git checkout -b feature/awesome-feature) - Test thoroughly on multiple Windows 11 systems
- Update documentation if needed
- Commit changes (
git commit -m 'Add awesome feature') - Push to branch (
git push origin feature/awesome-feature) - Open a Pull Request
- β PowerShell: Follow PowerShell best practices and PSScriptAnalyzer rules
- β Batch: Use modern CMD syntax, proper error handling
- β Documentation: Update README.md for new features
- β Testing: Test on both x64 and ARM64 if possible
- β Compatibility: Maintain Windows 11 24H2+ compatibility
- Proxy Support: Enhanced network configuration handling
- Localization: Multi-language support for error messages
- GUI Version: Windows Forms or WPF interface
- Reporting: HTML/JSON output formats
- Integration: Additional deployment methods (Chocolatey, winget)
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Mikhail Deynekin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Mikhail Deynekin
- π Website: deynekin.com
- π§ Email: [email protected]
- π GitHub: @paulmann
- π Documentation: Read this README thoroughly
- π Bug Reports: Open an issue
- π‘ Feature Requests: Request features
- π¬ Questions: Check Discussions
- Microsoft-Activation-Scripts - Windows activation tools
- Windows11Debloat - Remove Windows 11 bloatware
- PowerShell-Suite - PowerShell utilities collection
- GUI Version: User-friendly Windows Forms interface
- Package Managers: Chocolatey and winget support
- Proxy Support: Enhanced corporate network compatibility
- Scheduling: Built-in task scheduler integration
- Rollback: Automated rollback capabilities
- Multi-Language: Localized error messages and UI
- v1.0.0 (2025-10-01):
- β Initial PowerShell version with full feature set
- β Added Batch file alternative for ExecutionPolicy-free deployment
- β Comprehensive documentation and examples
- β Enterprise deployment guides
- β CI/CD integration examples
| Feature | Current Status | PowerShell | Batch | GUI (Planned) |
|---|---|---|---|---|
| Architecture Detection | β Complete | β | β | β |
| Download with Retry | β Complete | β | β | β |
| Digital Signature Check | β | β | β | |
| Comprehensive Logging | β | β | ||
| Parameter Support | β | β | β | |
| Progress Reporting | π§ Basic | β | ||
| Rollback Support | β Planned | π§ | π§ | π§ |
| Proxy Support | β Planned | π§ | π§ | π§ |
Legend: β
Complete |
Windows 11 25H2 Update Script - Making Windows updates fast, reliable, and enterprise-ready πβ¨