I have encountered an issue when using Windows Update Agent (WUA) API.
Whenever I try to uninstall an update using IUpdateInstaller.IsForced := True;
IUpdateInstaller.BeginUninstall(...
i'm getting WU_E_UNINSTALL_NOT_ALLOWED
(The update could not be uninstalled because the request did not originate from a WSUS server). Does it mean that I can't use WUA API to uninstall updates? In that case, why are BeginUninstall/Uninstall methods there?
According to Hey, Scripting Guy! How Can I Remove a Microsoft Update? (and also here) the WUA API can only be used to uninstall updates that were installed by a WSUS server.
You might be able to use DISM instead, e.g., see here and here. (Note that Windows updates are refered to as "packages" in DISM terminology.)
来源:https://stackoverflow.com/questions/38936202/wua-api-unable-to-uninstall-updates