Script to Pull the information of Patching

Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
intHistoryCount = objSearcher.GetTotalHistoryCount
Set colHistory = objSearcher.QueryHistory(1, intHistoryCount)
For Each objEntry in colHistory
    Wscript.Echo "Date: " & objEntry.Date
    Wscript.Echo "Title: " & objEntry.Title
    Wscript.Echo "Client application ID: " & objEntry.ClientApplicationID
    Wscript.Echo
Next

If(colHistory.Count <> 0) Then
Wscript.Echo " Server has been Patched. Total " & colHistory.Count & " Patches Installed"
Wscript.Echo
End If

No comments:

Post a Comment