Search code examples
c++cregistrywindows-updatewuapi

How to detect windows update status


I want to detect current windows 10 update status programmatically.

I tried wuapi and it works well but there are some problems in wuapi.

First, it takes long time to get update information.

Second, it can not be used at offline.

Is there any other method to detect current windows 10 update status? Is there any registry or system file to detect it?

I tried procmon to analyse but there are too many files and registries linked with windows udpate.

Thank you...


Solution

  • There is no documented way to access the search results that Automatic Updates is using (the results that the Windows Update page in Settings displays).

    However, there are two things that might be of use to you:

    • You can use IAutomaticUpdatesResults::LastInstallationSuccessDate to immediately see the last time the computer installed updates successfully. If all you want to know is "Is this PC processing updates successfully?", then this may be all you need.
    • You can use a Windows Update API search to see what updates are needed. Here's a script you can use as a starting point. If you use this script as written, it will go online to find newly-released updates, which isn't what you want in your scenario. But you can set your IUpdateSearcher object's Online property to false before calling Search. Doing that will perform an offline scan, in which WU just re-evaluates the updates it already knows about. This will work offline and will also return faster results.