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.