Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set UpdateSession = CreateObject("Microsoft.Update.Session")
- Set UpdateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
- Set UpdateService = UpdateServiceManager.AddScanPackageService("Offline Sync Service", "C:\wsusscn2.cab", 1)
- ' UpdateService must use absolute path
- Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
- WScript.Echo "Searching for updates..." & vbCRLF
- UpdateSearcher.ServerSelection = 3 ' ssOthers
- UpdateSearcher.ServiceID = UpdateService.ServiceID
- Set SearchResult = UpdateSearcher.Search("IsInstalled=0")
- Set Updates = SearchResult.Updates
- If searchResult.Updates.Count = 0 Then
- WScript.Echo "There are no applicable updates."
- WScript.Quit
- End If
- ' WScript.Echo "List of applicable items on the machine when using wssuscan.cab:" & vbCRLF
- Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile("update_missing.txt",8,true)
- objFileToWrite.WriteLine("==Start of Update missing list==")
- For I = 0 to searchResult.Updates.Count-1
- Set update = searchResult.Updates.Item(I)
- ' WScript.Echo I + 1 & "> " & update.Title
- objFileToWrite.WriteLine(I + 1 & "> " & update.Title)
- Next
- objFileToWrite.WriteLine("==End of Update missing list==")
- objFileToWrite.Close
- Set objFileToWrite = Nothing
- WScript.Echo "There are " & searchResult.Updates.Count & " updates, compiled to update_missing.txt"
- WScript.Quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement