;Winbatch 2019B - Windows Update Helper - no error handler
;code not complete, just a starting point for COM Objects
;Stan Littlefield, December 28,2019
;========================================================================================
updateSession = CreateObject("Microsoft.Update.Session")
updateSearcher = updateSession.CreateUpdateSearcher()
updatestoInstall = CreateObject("Microsoft.Update.UpdateColl")
BoxOpen("Update Session Objects","Initiated")
upds = updateSearcher.Search("IsInstalled=1 and Type='Software'").Updates
For i = 0 To upds.Count-1
upd= upds.Item(i)
Boxtext("Update ":i+1:" ":upd.Title) ; or save to file or shown in grid
TimeDelay(1)
Next
;====== this section to be tested ======================================
;create a similar collection for not installed
;upds = updateSearcher.Search("IsInstalled=0 and Type='Software'").Updates
;If upds.Count==0
; BoxText("No Updates pending install"0
;Else
; BoxText("Preparing Downloads")
; For i = 0 To upds.Count-1
; upd= upds.Item(i)
; updatestoInstall.Add(upd)
; Next
; downloader= updateSession.CreateUpdateDownloader()
; downloader.Updates = updatestoInstall
; downloader.Download()
;Endif
updateSession=0
updateSearcher=0
updatestoInstall=0
Exit
Cool ! I sometimes wonder if we shouldn't be controlling updates better. This shows a beginning.
thanks!
Thanks. I'm tweaking it to include the Date, Description, and level of severity. The collection to download section works but would probably want it as user select. I also read you can add a remote PC to the CreateObject().