Five years ago, I was working on a function to check for installed patches: GetAllPatches I was recently made the administrator of 6 Windows servers. Five are Windows 2003 R2, 32 bit and the last one is a Windows 2008, 64 bit. No one has patched these for years. The developers are afraid because they think patching will break their application. I have a large list of mandatory patches I am trying to check for. From two of the 2003 servers, I just don't get any results. From the 2008 server, I get that it does not seem to be running automatic updates, but I think it is. At least the group policy shows that it is. I create an ini file with the server names:
 Code:
[computers]
comp1=server1
comp2=server2
and another ini file with the required patches:
 Code:
[patch]
patch1=KB2655992
patch2=KB2691442
and then called my function with:
 Code:
Break On
Dim $SO
;
$SO = SetOpt('Explicit',          'On')
$SO = SetOpt('NoMacrosInStrings', 'On')
;
DIM $strWks, $strFile, $arrPatches[5,0], $intI
DIM $strComps, $strPatch, $colComps, $objComp, $colPatchs, $objPatch, $strPatchID
DIM $intErr, $binStatus
;
include "functions.kix"
;
$strFile  = "c:\temp\patch_compliance.ini"
$strComps = "c:\temp\computers.ini"
$strPatch = "c:\temp\patch.ini"
;
$colComps = Split(ReadProfileString($strComps,"computers",""),chr(10))
$colPatch = Split(ReadProfileString($strPatch,"patch",""),chr(10))
;
; If the patch report file exists, delete it to get a fresh copy.
;
If Exist($strFile)
   Del $strFile
   ? "Deleted the old patch report file."
EndIf
;
For Each $objComp in $colComps
   If $objComp <> ""
      $strWks - ReadProfileString($strComps,"computers",$objComp)
      ? "Checking patches on: " + $strWks
      ; First check to see if the automatic update service is running.
      If CheckAutoUpdate($strWks) = 0
         $arrPatches = GetAllPatches($strWks)
         If Ubound($arrPatches,2) > 0
            ; Check each patch we are interested in against the list of returned patches.
            For Each $objPatch in $colPatchs
               If $objPatch <> ""
                  $strPatchID = ReadProfileString($strPatch,"patch",$objPatch)
                  ? "Checking for patch, " + $strPatchID
                  $binStatus = 0
                  For $intI = 1 to Ubound($arrPatches,2)
                     If Instr($arrPatches[0,$intI],$strPatchID)
                        $intErr = WriteProfileString($strFile,$strPatchID,$strWks,$arrPatches[4,$intI])
                        $binStatus = 1
                     Else
                        $intErr = WriteProfileString($strFile,$strPatchID,$strWks,"could not find this patch")
                     EndIf
                  Next
                  If $binStatus = 0
                     $intErr = WriteProfileString($strFile,$strPatchID,$strWks,"Not Installed")
                  EndIf
               EndIf
            Next
         Else
            ? "Did not receive results from " + $strWks
            $intErr = WriteProfileString($strFile,$strPatchID,$strWks,"Could not read from this system")
         EndIf
         ? "-----------------------------------------------"
      Else
         ? "Automatic updates does not seem to be running on " + $strWks
      EndIf
   EndIf
Next


Three servers work fine. Two others, I just don't get any results. For the Windows 2008 server, it says it is not running automatic updates. I thought it might be a problem trying to query a remote server, but I get the same results if I run it on the problem server. Any suggestions?