locked
Searching for Installed Windows Updates RRS feed

  • Question

  • I would like to quickly query for Windows Updates that have already been installed.  I am currently using the Windows Update Agent API to do this but it takes entirely too long to run.  The query I am using within the IUpdateSearcher.Search (https://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=vs.85).aspx) method is as follows:


    "IsInstalled=1 and IsHidden=0"


    This query takes between 15 and 20 minutes to complete.  This is too long for my purposes.  I have not been able to find any useful information as to how I can speed this up or another alternative.


    I have noticed that "Control Panel -> Programs -> Programs and Features -> Installed Updates"  is able to get a list of all the installed updates within several seconds.  This was done on Windows 7 SP1 64 bit.


    In conclusion, is there a way I can speed up IUpdateSearcher.Search to get a list of installed updated?  Alternatively, do you know how Microsoft is getting the list of installed updated in "Control Panel -> Programs -> Programs and Features -> Installed Updates"?


    Also, the code I am using to perform my query can be found at (I am only performing the search portion so stop at approximately line 22):

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa387102(v=vs.85).aspx


    Wednesday, December 16, 2015 10:23 PM

All replies

  • I would like to quickly query for Windows Updates that have already been installed.  I am currently using the Windows Update Agent API to do this but it takes entirely too long to run.  The query I am using within the IUpdateSearcher.Search (https://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=vs.85).aspx) method is as follows:


    "IsInstalled=1 and IsHidden=0"


    This query takes between 15 and 20 minutes to complete.  


    The method you are using actually causes WUAgent to perform a complete detection of "current state" against MU/WU online webservice.

    If you're only interested in "current state" and only for Windows Updates (not Office Updates), you can instead do a pretty quick enumeration of the WMI class Win32_quickfixengineering;

    SELECT * FROM Win32_QuickFixEngineering

    or, via commandline: WMIC qfe

    or, in Powershell: gwmi -class win32_quickfixengineering


    Don [doesn't work for MSFT, and they're probably glad about that ;]

    Thursday, December 17, 2015 12:25 AM
  • Hi Greg Valainis,

    > Alternatively, do you know how Microsoft is getting the list of installed updated in "Control Panel -> Programs -> Programs and Features  -> Installed Updates"?

    Do you mean this:

    If so, click Control Panel> system and security> windows update > view update history.

    Anne


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    Thursday, December 17, 2015 8:53 AM
  • Anne,

    Let me state another requirement for my question, this must be done programatically.  What you have shown me can be accomplished by performing the IUpdateSearcher.QueryHistory method, which is not adequate.

    Tuesday, December 29, 2015 12:38 PM
  • DonPick,

    Thank you for your answer.  What you have shown me is quite useful and gives a nice list of updates in a speedy manner, however this does not accomplish what I need done.  I should have stated this in the original question, but this needs to be able to work on Windows XP and up, which the Win32_QuickFixEngineering only works on Vista and up.

    Tuesday, December 29, 2015 12:40 PM
  • Greg,

    I posted some C++ code (C++, Standards, Extensions& Interop Forum) in response to your question that will produce the Installed Updates list.  Although the posted code required Win 7 or higher, with a small change it can be made to work on Vista.  However, I don't believe that similar programmatic access to the Installed Updates list was available on XP.

    Tuesday, December 29, 2015 6:06 PM