Fix Server 2022 Windows Update 0x800f0831 with CBS_E_STORE_CORRUPTION in CBS.log
The 0x800f0831 error message in Windows update is dreaded by many sysadmins! there are some well known fix’s such as the one noted in my post How do I reset Windows Update using Powershell? . Recently I have seen a number of servers where this well know process does not work. After much trial and error I now have the process below which works well. Note I developed this process on Server 2022.
Firstly take a look at the CBS log located at C:\Windows\Logs\CBS\CBS.log and search for the error ‘CBS_E_STORE_CORRUPTION’. If you find this then the process below may resolve your issue.
Check in the CBS logs for the string of text Failed to pin deployment which will highlight the missing component that is missing.
2024-05-10 04:04:37, Info CBS Failed to pin deployment while resolving Update: Microsoft-Windows-DhcpServerRole-Package~31bf3856ad364e35~amd64~~10.0.20348.2227.DHCPServer from file: (null) [HRESULT = 0x80073701 - ERROR_SXS_ASSEMBLY_MISSING]
Microsoft-Windows-DhcpServerRole-Package is the name of the package that is missing.
10.0.20348.2227 is the version of the package that is missing.
Google the version . and it will tell you the Window Update it refers to e.g. version is 10.0.20348.2227 January 9, 2024—KB5034129 . Download the package from the Windows Update Catalogue
Expand the MSU file by the using the below at the command prompt which will output all the CAB files.
expand filename.msu .\temp -F:*
Expand the extracted CAB file for the update e.g. Windows10.0-KB5034129-x64.CAB
expand filename.CAB.\temp -F:*
This will export another CAB file with the same name as the one you extracted above. Expand this one as well. This will create a folder will all the update components. In this folder search for the package you are looking for.
Microsoft-Windows-DhcpServerRole-Package = Microsoft-Windows-DhcpServerRole-Package~31bf3856ad364e35~amd64~~10.0.20348.2227.mum
Now use DISM to install the missing component
dism /online /add-package /packagepath:Microsoft-Windows-DhcpServerRole-Package~31bf3856ad364e35~amd64~~10.0.20348.2227.mum
Rerun Windows Updates and it should complete this time successfully hopefully. Note thought you may have to go through the process a number of times if multiple packages are missing.
Thank you for this process.
In my case i had also to check in the CBS logs for the string of text “Failed to bulk stage deployment manifest and pin deployment”
e.g.:
2024-06-18 23:06:28, Info CBS Failed to pin deployment while resolving Update: Microsoft-Windows-TerminalServices-Licensing-Package~31bf3856ad364e35~amd64~~10.0.20348.2110.Licensing from file: (null) [HRESULT = 0x80073701 – ERROR_SXS_ASSEMBLY_MISSING]
2024-06-18 23:06:28, Info CBS Failed to bulk stage deployment manifest and pin deployment for package:Microsoft-Windows-msmq-runtime-Opt-WOW64-Package~31bf3856ad364e35~amd64~~10.0.20348.2322 [HRESULT = 0x80073701 – ERROR_SXS_ASSEMBLY_MISSING]
I use this process which works well by marking the corrupted packages as absent.
Even if the CBS.log is pointing to a corrupted package with version .1 (RTM)
e.g.:
2024-07-16 15:35:26, Error CSI 00000298 (F) HRESULT_FROM_WIN32(ERROR_SXS_ASSEMBLY_MISSING) #5500020# from Windows::ServicingAPI::CCSITransaction::ICSITransaction_PinDeployment(Flags = 0, a = HyperV-HvSocket-Deployment, version 10.0.20348.1, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}, cb = (null), s = (null), rid = ‘HyperV-HvSocket-Package~31bf3856ad364e35~amd64~~10.0.20348.1.6cdd0ff9c702dc036c10279b44e48d03’, rah = (null), manpath = (null), catpath = (null), ed = 0, disp = 0)[gle=0x80073701]
2024-07-16 15:35:26, Info CBS Failed to pin deployment while resolving Update: HyperV-HvSocket-Package~31bf3856ad364e35~amd64~~10.0.20348.1.6cdd0ff9c702dc036c10279b44e48d03 from file: (null) [HRESULT = 0x80073701 – ERROR_SXS_ASSEMBLY_MISSING]
Most likely root cause:
Caused by an unexpected shutdown (not Windows Update itself) during a servicing operation.
The TrustedInstaller (Windows Modules Installer) service running cleanup, cumulative update tasks during a dirty shutdown and causes missing/corrupted components:
0x80073701 – ERROR_SXS_ASSEMBLY_MISSING
0x800f0831 – CBS_E_STORE_CORRUPTION
In the registry, a lot of packages are present in the “Staged” state, a state in which files are present in the system but in a partial state.
In case you want to check the name and number, run the below command in an admin powershell and the names will be displayed:
Get-ItemProperty “hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\*” | ?{$_.Currentstate -eq “64”} | select PSchildName
Resolution for WU error 0x80073701 / 0x800f0831:
Run this .ps1 file in an admin PowerShell, reboot the device and reapply the Patch Tuesday KB.
The script will mark the corrupted packages as absent.
$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
}
}
Success!