Windows Update Script for 23H2 and 24H2

Please correct me if I’m missing anything, but I’ve received several repeat questions about updating to Windows 11 23H2 or 24H2. From what I’ve researched, these particular feature updates appear to deviate from the typical Windows 10 feature update, which was easy to handle with a generic script. I’ll add my notes plus links to the community scripts I added to the library:

Windows 11 Enablement Package for 23H2

Windows 11 23H2 is Odd. Per Microsoft, it was installed via a 22H2 Security Update back in Oct 2023 and you have to “Enabled” with an “Enablement package”. A Windows 11 22H2 machine needs to be fully up to date for this to work

> <#
> 
> No guarantees this will work for everyone. Test this script on in a Lab enviroment before applying to production.
> 
> Windows 11 23H2 is an OddBall. Apparently it was installed via a 22H2 Security Update back in Oct 23 
> and you have to "Enabled" with a "Enablement package"
> 
> Citing:
> https://www.thurrott.com/windows/windows-11/294170/still-stuck-on-windows-11-version-22h2-you-can-upgrade-to-23h2
> https://www.minitool.com/news/windows-11-23h2-enablement-package.html
> Microsoft Official: https://support.microsoft.com/en-us/topic/kb5027397-feature-update-to-windows-11-version-23h2-by-using-an-enablement-package-b9e76726-3c94-40de-b40b-99decba3db9d
> 
> As long as the Windows 22H2 machine is fully up to date, you should be able to run this powershell script.
> There is a different URL Download in case you have any ARM machine. See Citations above for additional information
> 
> #>
> 
> # Define the URL and file path
> $url = "https://catalog.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/caa3ff4a-6420-4341-aeae-33b2d7f463be/public/windows11.0-kb5027397-x64_3a9c368e239bb928c32a790cf1663338d2cad472.msu"
> $output = "$env:TEMP\windows11.0-kb5027397-x64.msu"
> 
> # Download the file
> Invoke-WebRequest -Uri $url -OutFile $output
> 
> # Install the update
> wusa.exe $output /quiet /norestart

Force Windows Update Script for 24H2

For 24H2, based on some research and a Microsoft Answers post from here, which I will quote below:

If you don’t see 24H2 available in Windows Update, your computer might not support 24H2, your hardware is on a compatibility hold, or you don’t have enough storage.
If you really feel the need to have 24H2, you can use the Windows 11 Installation Assistant, the Windows 11 ISO, or the Media Creation Tool. All three of these options will get you to Windows 11, version 24H2.
To use the Windows 11 Installation Assistant, download the Windows 11 Installation Assistant and then run it. You should see some prompts telling you about Windows 11 and what it’ll install. Let it download and install 24H2.
To use the Windows 11 Media Creation Tool, download the Windows 11 Media Creation Tool, and run the MCT. Once it finishes loading, push “Upgrade this PC Now”. Let the MCT install the Windows 11 installation files, and then let it check for updates, and then let it install Windows 11.
To use the Windows 11 ISO, download the Windows 11 ISO, (you can find it here, scroll down to where you see ISO for Windows 11 x64 devices), mount it, and then run setup.exe (if you see a UAC prompt, push yes). Follow the prompts on-screen and then let setup.exe update and install Windows 11, 24H2.
All of these steps will get you to 24H2 and will take a while to install. It’s best to do this at night when you’re not doing anything important. Just make sure to save your files before you start.

This tracks with what I have noticed in a few test VMs. I have a script that does download and run the Windows 11 Installation Assistant via the Syncro Scripting module: https://subdomain.syncromsp.com/shared_scripts/2055

I tried running this script multiple times on a VM that was a Windows 11 21H2 OS release, but nothing seemed to happen. After multiple times fighting with the VM, low and behold the post was right, my issue was:

your hardware is on a compatibility hold

My VM only had 60 GB of total storage and I did not have a virtual TPM added. I expanded the Virtual Drive to 80GB and added in a virtual TPM 2.0 and manually ran the script’s code in Powershell ISE. This time the machine did run the update rebooted and it moved from 21H2 to 24H2 in one go.
Here is the Windows 11 Installation Assistant Script for reference:

<#

This powershell script will download and run the Windows 11 Installation Assistant program from Microsoft.

If the computer meets the requirements for the Windows 11 update, after the Installation Assistant runs the machine will
automatically reboot and load Windows 11. If for some reason the machine does not meet all the requirements the script
will still download and run the Installation Assistant, which will still attempt the update but fail and reboot back
into Windows 10.

Microsoft requirements can be found here: Windows 11 Specs and System Requirements | Microsoft Windows

#>

$WebClient = New-Object System.Net.WebClient

#URL to Windows 11 Update Assistant
$Win11UpgradeURL = “https://go.microsoft.com/fwlink/?linkid=2171764
$UpgradePath = “$env:TEMP\Windows11InstallationAssistant.exe”
$WebClient.DownloadFile($Win11UpgradeURL, $UpgradePath)

Start-Process -FilePath $UpgradePath -ArgumentList “/Install /MinimizeToTaskBar /QuietInstall /SkipEULA”

2 Likes

Re the lack of TPM this should be caught if you run the MS based assessment tool. We used a device custom field to pre process machines. Space has been the most common reason for upgrades failing for us but a couple AV ones as well.

covered it here. Windows 11 Upgrade through script - General - Syncro Community