Set updateSession = CreateObject("Microsoft.Update.Session") Set updateSearcher = updateSession.CreateupdateSearcher() 'WScript.Echo "Searching for updates..." & vbCRLF Set searchResult = _ updateSearcher.Search("IsInstalled=0 and Type='Software'") 'WScript.Echo "List of applicable items on the machine:" 'For I = 0 To searchResult.Updates.Count-1 'For I = 0 To 3 ' Set update = searchResult.Updates.Item(I) ' WScript.Echo I + 1 & "> " & update.Title 'Next If searchResult.Updates.Count = 0 Then WScript.Echo "There are no applicable updates." WScript.Quit End If 'WScript.Echo vbCRLF & "Creating collection of updates to download:" Dim updateList Set updateList = CreateObject("System.Collections.ArrayList" ) For I = 0 to searchResult.Updates.Count-1 'For I = 0 to 2 Set update = searchResult.Updates.Item(I) Dim urlList set urlList = createObject("System.Collections.ArrayList" ) For J = 0 to update.BundledUpdates.Count-1 Set update2 = update.BundledUpdates.Item(J) 'WScript.Echo I +1 &" " & J + 1 & "> " & update.Title & update2.DownloadContents.Count For K = 0 to update2.DownloadContents.Count-1 Set update3 = update2.DownloadContents.Item(K) urlList.Add update3.DownloadUrl Next Next updateList.Add update.Title '& " " update.KBArticleID updateList.Add urlList Next Set oFSO = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("Wscript.Shell") sFile = oShell.ExpandEnvironmentStrings("%TEMP%") & "\updates.txt" Set f = oFSO.CreateTextFile(sFile, True, OpenAsASCII) f.WriteLine "Report run at " & Now f.WriteLine searchResult.Updates.Count & " updates found" f.WriteLine "---------------------------------" & "---------------------------------" For I = 0 to updateList.Count-1 f.WriteLine "Update:" & vbTab & updateList.Item(I) I = I + 1 set urls = updateList.Item(I) For J = 0 to urls.Count-1 f.WriteLine "Url:" & vbTab & vbTab & urls.Item(J) Next Next f.WriteLine "---------------------------------" & "---------------------------------" f.Close oShell.Run "notepad.exe " & """" & sFile & """", 1, False