Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:05:35+00:00 2026-06-13T00:05:35+00:00

When we try to retrieve the Windows Update Information with WUA API, the following

  • 0

When we try to retrieve the Windows Update Information with WUA API, the following is the process I have followed. But I am bit confused with IUpdate::BundledUpdates property.

  1. Create an IUpdateSearcher
  2. Search based on a search criteria. I provided search criteria as “IsHidden=1 or IsInstalled=1”
  3. You will have a IUpdateCollection as result of search.
  4. Using get_Item in IUpdateCollection, I retrieved each update (IUpdate) and printed the required values (KB numbers in my case).
  5. But again in IUpdate, you have a BundledUpdate property that gives IUpdateCollection with get_BundledUpdates() method. When I iterated over the results of BundledUpdates, I have got no results.

Am I missing something in retrieving bundled updates? (OR) does the criteria I specified includes Bundled Updates as part of first result set of IUpdateCollection?

Also in MSDN, examples are lacking for each interface in WUA API, Could someone provide any resources that explains clearly what each interface in WUA API does?

Added full source code of C++ console Application:

#include <wuapi.h>
#include <iostream>
#include <wuerror.h>

using namespace std;


int main()
{

    HRESULT hr;
    hr = CoInitialize(NULL);

    IUpdateSession* iUpdate;
    IUpdateSearcher* searcher;
    ISearchResult* results;
    BSTR criteria = SysAllocString(L"IsInstalled=1 or IsHidden=1 or IsPresent=1");

    hr = CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER,
        IID_IUpdateSession, (LPVOID*)&iUpdate);
    hr = iUpdate->CreateUpdateSearcher(&searcher);

    wcout << L"Searching for updates ..."<<endl;
    hr = searcher->Search(criteria, &results);
    SysFreeString(criteria);

    switch(hr)
    {
    case S_OK:
        wcout<<L"List of applicable items on the machine:"<<endl;
        break;
    case WU_E_LEGACYSERVER:
        wcout<<L"No server selection enabled"<<endl;
        return 0;
    case WU_E_INVALID_CRITERIA:
        wcout<<L"Invalid search criteria"<<endl;
        return 0;
    }

    IUpdateCollection * updateList;
    IUpdate *updateItem;
    LONG updateSize;
    BSTR updateName;

    results->get_Updates(&updateList);
    updateList->get_Count(&updateSize);

    if (updateSize == 0)
    {
        wcout << L"No updates found"<<endl;
    }

    for (LONG i = 0; i < updateSize; i++)
    {
        IStringCollection *KBCollection;
        LONG KBCount;
        updateList->get_Item(i, &updateItem);
        updateItem->get_KBArticleIDs(&KBCollection);
        KBCollection->get_Count(&KBCount);
        for(int k=0;k<KBCount;k++)
        {
            BSTR KBValue;
            KBCollection->get_Item(k,&KBValue);
            wcout << L"KB" << KBValue << endl;
        }

        //Retrieve the bundled updates
        IUpdateCollection *updtCollection;
        updateItem->get_BundledUpdates(&updtCollection);
        LONG updtBundledCount;
        updtCollection->get_Count(&updtBundledCount);
        for(LONG j=0;j<updtBundledCount;j++)
        {
            cout<<"Bundled KBs" <<endl;
            IUpdate *bundledUpdateItem;
            updtCollection->get_Item(j,&bundledUpdateItem);
            bundledUpdateItem->get_KBArticleIDs(&KBID);
            if(KBID != NULL)
            {
                LONG KBCount;
                BSTR KBIDValue;

                KBID->get_Count(&KBCount);
                for(LONG j=0;j<KBCount;j++)
                {

                    wcout << "KB" <<(KBIDValue) << endl;
                    temp.setKBID(KBIDValue);
                }
            }
        }
    }

    wcout << L"Total KB Count : " << updateSize << endl;
    CoUninitialize();

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:05:36+00:00Added an answer on June 13, 2026 at 12:05 am

    I just fix your code in order to retrieve the Bundled Updates.

    #include "stdafx.h"
    #include <wuapi.h>
    #include <iostream>
    #include <wuerror.h>
    
    using namespace std;
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        HRESULT hr;
        hr = CoInitialize(NULL);
    
        IUpdateSession* iUpdate;
        IUpdateSearcher* searcher;
        ISearchResult* results;
        BSTR criteria = SysAllocString(L"IsInstalled=1 or IsHidden=1 or IsPresent=1");
    
        hr = CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (LPVOID*)&iUpdate);
        hr = iUpdate->CreateUpdateSearcher(&searcher);
    
        wcout << L"Searching for updates ..."<<endl;
        hr = searcher->Search(criteria, &results); 
        SysFreeString(criteria);
    
        switch(hr)
        {
        case S_OK:
            wcout<<L"List of applicable items on the machine:"<<endl;
            break;
        case WU_E_LEGACYSERVER:
            wcout<<L"No server selection enabled"<<endl;
            return 0;
        case WU_E_INVALID_CRITERIA:
            wcout<<L"Invalid search criteria"<<endl;
            return 0;
        }
    
        IUpdateCollection *updateList;
        IUpdate *updateItem;
        LONG updateSize;
        BSTR updateName;
    
        results->get_Updates(&updateList);
        updateList->get_Count(&updateSize);
    
        if (updateSize == 0)
        {
            wcout << L"No updates found"<<endl;
        }
    
        for (LONG i = 0; i < updateSize; i++)
        {
            IStringCollection *KBCollection;
            LONG KBCount;
            updateList->get_Item(i,&updateItem);
            updateItem->get_Title(&updateName);
            wcout<<i+1<<" - "<<updateName<<endl;
    
            IUpdateCollection *updtCollection;
            LONG updtBundledCount;        
            //Retrieve the bundled updates
            updateItem->get_BundledUpdates(&updtCollection);
            hr = updtCollection->get_Count(&updtBundledCount);
            if ((updtBundledCount>0) && (hr ==S_OK))
            {
                wcout << L"Bundled Updates " <<(updtBundledCount) << endl;
                for(LONG j=0;j<updtBundledCount;j++)
                {
                    IUpdate *bundledUpdateItem;
                    BSTR bundledName;
                    updtCollection->get_Item(j,&bundledUpdateItem);   
                    bundledUpdateItem->get_Title(&bundledName);
                    wcout<<L"    "<<j+1<<" - "<<bundledName<<endl;
                }
            }
        }
        ::CoUninitialize();
        wcin.get();
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to retrieve some information(x,y,width,height and title) for all opened window on Windows
I try to retrieve how to scan wireless networks on the windows phone. I
I have the following code: self.bg_br = mechanize.Browser() self.bg_br.retrieve(self.bg_imageurl, image2.jpg) self.bg_file2 = open(image.jpg, mode=w)
I try to retrieve a list of the attribute values of the children of
I am currently try to retrieve a latitude and longitude value from a location.
I am using mysqli to try and retrieve the teacher's username and then insert
I get a Data type mismatch criteria expression error when i try to retrieve
I'm trying to retrieve this page using Apache HttpClient: http://quick-dish.tablespoon.com/ Unfortunately, when I try
try: html = urlopen('http://glbse.com/api/asset/' + asset.name) except: print 'error while updating the price of
I am making an app that uses the internet to retrieve information. I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.