Just playing around and the output is ugly.... but trying to get the count of the historycount() prior to any display.
;Winbatch 2019 - working with Windows Updates
;Stan Littlefield, June 17, 2019
;=====================================================================================
oSession = CreateObject("Microsoft.Update.Session")
oSearcher = oSession.CreateUpdateSearcher()
oHistory = oSearcher.GetTotalHistoryCount()
results = oSearcher.QueryHistory(1,oHistory)
filter = "SQL Server"
ForEach r in results
If StrIndexNC(r.Title,filter,0,@FWDSCAN)
txt = r.Date:@LF:r.Title:@LF:r.Description:@LF:r.SupportUrl
Display(2,"Update Results:",txt)
Endif
Next
oHistory =0
oSearcher =0
oSession =0
Exit
;=====================================================================================