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