🛠️ Fixing Windows Update Failures on Windows Server 2022: A Quick PowerShell Solution

Running into the ERROR_SXS_ASSEMBLY_MISSING error during updates? Here's a simple PowerShell fix to get your server patched and running smoothly again.

Posted by Rodin Frese on 7th Jun 2025

How to Fix Windows Update Failing with ERROR_SXS_ASSEMBLY_MISSING on Windows Server 2022

If you’ve ever run into issues installing Windows updates on a Windows Server 2022 machine, you’re definitely not alone. One frustrating error that can pop up is ERROR_SXS_ASSEMBLY_MISSING. You might spot it in the CBS log file (C:\Windows\Logs\CBS\CBS.log) after a failed update.

This particular error usually means that Windows is trying to load a system component that’s missing or corrupted, and it simply can’t find it. As a result, the update fails, and your server misses out on important patches.

👉 This article specifically covers a fix for Windows Update error codes 0x80073701 and 0x800f0831, which are often tied to the ERROR_SXS_ASSEMBLY_MISSING issue in Windows Server 2022.


What’s Causing the Error?

The culprit is often a corrupted or incomplete package in the Windows Component Store. When something goes wrong during an update—or if a previous update didn’t install cleanly—it can leave behind broken references that Windows doesn’t know how to handle.


Thankfully, there’s a PowerShell script that can help clean this up. What it does is go through the list of installed component packages in the registry and look for ones that are marked with a problematic state (0x50 or 0x40). These usually indicate something’s wrong. The script then resets those entries so that Windows treats them as if they were never installed—giving it a clean slate to try again.

Here’s the script:

$name = 'CurrentState'
$check=(get-childitem -Path 'HKLM:\software\microsoft\windows\currentversion\component based servicing\packages' -Recurse).Name

foreach($check1 in $check)
{
$check2=$check1.replace("HKEY_LOCAL_MACHINE","HKLM:")
if((Get-ItemProperty -Path $check2).$name -eq 0x50 -or (Get-ItemProperty -Path $check2).$name -eq 0x40 )
{
write-host (Get-ItemProperty -Path $check2).PSChildName
Set-ItemProperty -Path $check2 -Name $name -Value 0
}
}

What Does This Script Do?

  • Scans the registry under the CBS packages path.

  • Finds packages with a corrupted state.

  • Resets them, so Windows won’t treat them as active anymore.


What to Do After Running It

  1. Reboot the server to make sure the changes apply.

  2. Try running Windows Update again. You’ll likely see better results this time.

  3. Optionally, you can run a DISM scan for good measure:
    dism /online /cleanup-image /restorehealth


A Quick Heads-Up

This script modifies your system registry, so be cautious. Always take a backup or snapshot before running it—especially in a production environment.

Â