\:\)

I have 29 Windows 2008 servers that I am responsible to administer, but the patches are applied at the domain level. I don't have access to that. I have to report when a critical vulnerability has been discovered (CVE) whether the systems have been patched. So, I was trying to find a method to search for the applied patches. I'll have to take a look at the registry locations. In the meantime, this is what I was working on so far:

 Code:
;NAME  check_win_patch.kix
;
;DESCRIPTION  This is a script to check for patches on systems.
;
Break On
Dim $SO
;
$SO = SetOpt('Explicit',          'On')
$SO = SetOpt('NoMacrosInStrings', 'On')
;
Dim $strWks, $strComps, $colComps, $objComp
;
$strComps = "u:\Desktop\computers.ini"
;
$colComps = Split(ReadProfileString($strComps,"computers",""),chr(10))
;
For Each $objComp in $colComps
   If $objComp <> ""
      $strWks - ReadProfileString($strComps,"computers",$objComp)
   EndIf
   GetAllPatches($strWks)
   ; more stuff to do here
Next
;
Function GetAllPatches($strWks)
   Dim $objSession, $objSC, $objSearcher, $colUpdates, $intI, $intHistoryCount, $objIdentity, $objUpdate, $objIdentity
   ;
   $objSC = CreateObject("ScriptControl")
   If @ERROR
      ? "There was an error creating the scriptcontrol object " + @SERROR
   EndIf
   $objSC.language = "VBScript"
   $objSC.addcode('Session=CreateObject("Microsoft.Update.Session","' + $strWks + '")')
   If @ERROR
      "There was an error creating the Update Session object"
      ? @SERROR
   EndIf
   $objSC.run
   If @ERROR
      ? "There was an error running the Update Session object " + @SERROR
   EndIf
   $objSession = $objSC.codeobject.session
   If @ERROR
      ? "There was an error creating the Session Object after running the Update Session " @SERROR
   EndIf
   $objSearcher = $objSession.CreateUpdateSearcher
   If @ERROR
      ? " There was an error creating the Update Searcher object " + @SERROR
   EndIf
   $intHistoryCount = $objSearcher.GetTotalHistoryCount
   If @ERROR
      ? "There was an error getting the Update Searcher History count " + @SERROR
   EndIf
   $colUpdates = $objSearcher.QueryHistory(0, $intHistoryCount)
   If @ERROR
      ? "There was an error getting the update collection " + @SERROR
   EndIf
   ;
   ; I haven't really decided what to do with them yet.
   ; So, just printing out the data
   ;
   For Each $objUpdate in $colUpdates
      ? "Title:                   " + $objUpdate.Title
      ? "Description:             " + $objUpdate.Description
      ? "Update application date: " + $objUpdate.Date
      $intI = $objUpdate.Operation
      Select
         Case $intI = 1
            ? "Operation type:         Installation"
         Case $intI = 2
            ? "Operation type:         Uninstallation"
         Case 1
            ? "Operation type:         could not be determined"
      EndSelect
      $intI = $objUpdate.ResultCode
      Select
         Case $intI = 0
            ? "Operation result:       The operation has not started."
         Case $intI = 1
            ? "Operation result:       The operation is in progress."
         Case $intI = 2
            ? "Operation result:       The operation completed successfully."
         Case $intI = 3
            ? "Operation result:       The operation complted, but one or more errors occurred"
            ? "                        during the operation and the results are potentially incomplete."
         Case $intI = 4
            ? "Operation result:       The operation failed to complete."
         Case $intI = 5
            ? "Operation result:       The operation was aborted."
         Case 1
            ? "Operation result:       Could not be determined."
      EndSelect
      $objIdentity = $objUpdate.UpdateIdentity
      ? "Update ID:              " + $objIdentity.UpdateID
      ? "------------------------------------------------------------?
   Next
EndFunction


If there are any typos, I apologize. I have to re-type it all.

Regards,

Brad