2016-02-28

VBScript: How to get needed Windows updates count

Save sample below to a file named NeededUpadatesCount.vbs:

Set updateSession = CreateObject("Microsoft.Update.Session")
updateSession.ClientApplicationID = "Geecoholic Script"

Set updateSearcher = updateSession.CreateUpdateSearcher()

WScript.Echo "Searching for updates..." & vbCRLF

Set searchResult = _
updateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")

WScript.Echo "Updates Count: " & searchResult.Updates.Count
WScript.Quit


 You can run the sample by opening a Command Prompt window and typing the following command at the command prompt:

script NeededUpadatesCount.vbs

Script made using example from MS link

/Geecoholic

No comments:

Post a Comment