Skip to content

Instantly share code, notes, and snippets.

@jonman364
Created November 4, 2014 16:06
Show Gist options
  • Save jonman364/092d4aa2e151aeeddcae to your computer and use it in GitHub Desktop.
Save jonman364/092d4aa2e151aeeddcae to your computer and use it in GitHub Desktop.
' checkpatch.vbs
' Check if KB# patch is installed
Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
Set objResults = objSearcher.Search("Type='Software'")
Set colUpdates = objResults.Updates
strSearch = InputBox("Enter KB number")
if strComp(left(strSearch, 2), "KB", vbTextCompare) Then
num = CStr(strSearch)
strSearch = "KB" & num
End If
if strComp(strSearch, "KB", vTextCompare) = 0 Then
WScript.Quit
End If
For Each update in colUpdates
If InStr(1, update.Title, strSearch, vbTextCompare) <> 0 Then
If update.IsInstalled <> 0 Then
WScript.Echo update.Title & " is installed."
Else
WScript.Echo update.Title & " is not installed."
End If
End If
Next
WScript.Echo "Done Searching."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment