Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim updateSession, updateSearcher
- Set updateSession = CreateObject("Microsoft.Update.Session")
- Set updateSearcher = updateSession.CreateUpdateSearcher()
- strSearchCriteria = "IsInstalled=0 and DeploymentAction='OptionalInstallation'"
- Wscript.Stdout.Write "Checking for updates..." & vbCRLF
- Dim searchResult
- Set searchResult = updateSearcher.Search(strSearchCriteria)
- If IsEmpty(searchResult) Then
- WScript.Echo "The search did not return any updates."
- WScript.Quit(5)
- End If
- WScript.Echo "Updates found: " & CStr(searchResult.Updates.Count) & vbCRLF
- Dim update, KB, index
- For index = 0 To searchResult.Updates.Count - 1
- Set update = searchResult.Updates.Item(index)
- If update.IsHidden = False Then
- WScript."Hiding update: " & update.Title
- update.IsHidden = True
- Else
- WScript."Already hidden: " & update.Title
- End If
- Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement