WUA API unable to find update


Code sample:

$UpdateSession = New-Object -ComObject 'Microsoft.Update.Session'

$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
$Updates = $UpdateSearcher.Search('IsInstalled=1')

$Updates | Where-Object { $_.Title -like '*KB2506143*' }

I'm trying to uninstall WMF3 programmatically, but I keep getting errors when trying to utilize wusa.exe,

wusa /uninstall /kb:2506143 /quiet /norestart /log:C:\log.evt

CbsClient::CbsClient.00110: Failed to create a CBS session instance
CbsClient::CbsClient.00127: Exit with error code 0X80040154 (Class not registered)
UninstallWorker.00664: Start of search
CbsClient::OpenPackageByKB.00268: CBS session is not initialized.
CbsClient::OpenPackageByKB.00320: Exit with error code 0X8000ffff (Catastrophic failure)
UninstallWorker.00667: Failed: OpenPackageByKB() for KB2506143
UninstallWorker.00799: Exit with error code 0X8000ffff (Catastrophic failure)
RebootIfRequested.01446: Reboot is not scheduled. IsRunWizardStarted: 0, IsRebootRequired: 0, RestartMode: 1
Windows update could not be uninstalled because of error 2147549183 "Catastrophic failure" (Command line: "C:\windows\System32\wusa.exe /uninstall /kb:2506143 /quiet /norestart /log:C:\log.evt")
wWinMain.01962: Failed to uninstall update ; Error: 0X8000ffff, Catastrophic failure. Command line: C:\windows\System32\wusa.exe /uninstall /kb:2506143 /quiet /norestart /log:C:\log.evt
wWinMain.01998: Exit with error code 0X8000ffff (Catastrophic failure)

so I'm pursuing using the WUA API. The above code snippet gives me a $Null return, but I can use Get-Hotfix -ID KB2506143 or Get-WmiObject -Class Win32_QuickFixEngineering -Filter 'HotFixID="KB2506143"' to find the update.

This question is similar, but it's getting access denied when trying to uninstall the patch after it has already been found, while my question is: how do I find the patch in the first place?

I'm not sure how the patch got applied, so if I run into the same issue once I find it, I have that resolution at least.

asked on Stack Overflow Dec 6, 2017 by Maximilian Burszley • edited Dec 6, 2017 by Maximilian Burszley

1 Answer


So the purpose of all this was to upgrade to WMF5.1 programmatically and I found a workaround for what I was trying to accomplish. PowerShell v3 was enabled in the OS using DISM during the build process and cannot be removed by WUA because it wasn't placed there by WUA.

Workaround 1:

dism.exe /Online /Disable-Feature:MicrosoftWindowsPowerShellV3

This downgrades $PSVersionTable to v2, but it does not remove the patch KB2506143. This causes the need to uninstall it through the UI manually still so it didn't really accomplish what I need.

Workaround 2:

WMF3 cannot be upgraded to WMF5, but it can be upgraded to WMF4, then WMF5(.1).

Ultimately, I installed WMF4 over WMF3 with wusa.exe while still disabling v3 in dism for good measure and was successful installing WMF5.1 over WMF4 after a reboot (again, with wusa.exe).

The limitation is rooted with the WUA not being able to manage patches that it did not install (through a .msu or WSUS)

User contributions licensed under CC BY-SA 3.0