3

I'm making my own project where I will search for Microsoft updates but will not download/install using WUA API. I will use WUA API only for detection and to get the properties of the individual patches.

To make the above scenario work, through ISearchResult I can get the update interface. From that there is one property DownloadContent which will give me the IUpdateDownloadContentCollection interface through which I will get IUpdateDownloadContent interface and finally I can get download URL of the specified patch.

Initially the DownloadUrl property of IUpdateDownloadContent was not able to give any url. Later then I found out that downloadUrl was only available for patches of type ='Driver', and not for "Software type".

I searched through internet but no luck :(.

The reason I don't want to use COM API for downloading and installing is because I have seen whenever we use WUA API to download or install , the process "trustedinstaller.exe" starts running and takes most of the system resources and slowing it down.

Can someone please tell me why I'm not able to receive DownloadUrl for patches/updates of type = 'Software'.

Ðаn
  • 10,934
  • 11
  • 59
  • 95
ajit
  • 79
  • 8

2 Answers2

2

After doing so much research I finally got the answer. To get the DownloadUrl of Type = Software we have to use BundledUpdates property of Iupdate interface which will point out to the IupdateClassificationwhich in turn will gives us Iupdate interface from here we can get the DownloadUrl from DownloadContent

ajit
  • 79
  • 8
  • 1
    It is not that simple, because for each update, `BundledUpdates` is a collection with possible several bundled updates and for each bundle in the `BundledUpdates`, `DownloadContent` is again a collection with several files with a different `DownloadUrl`. So you need to add the logic to identify what bundle and download you need. – antonio Dec 28 '18 at 18:00
  • @ajit, @antonio Collection name is `DownloadContents`, not `DownloadContent` – NoSkill Mar 26 '21 at 15:17
-1

This PSEUDO-CODE shows how to get all URL-s of the searched updates.

SearchResult = UpdateSearcher.Search("Type='Software'")

FOR EACH (SearchResult.Updates AS Update) {
  FOR EACH (Update.BundledUpdates AS BundledUpdate) {
    FOR EACH (BundledUpdate.DownloadContents AS DownloadContent) {
      
      DISPLAY DownloadContent.DownloadUrl

    }
  }
}
NoSkill
  • 718
  • 5
  • 15