Created
November 4, 2014 16:06
-
-
Save jonman364/092d4aa2e151aeeddcae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 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