Just discovered that the "InstalledDate" value for updates is sometimes in US format and sometimes in European format!
Here is an example of how to find the latest update. Unfortunately it will fail because of the brain-dead implementation of InstalledDate, but if you are reading the details from somewhere with a consistant format you should be able to adapt it to your needs:
Code:
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
Dim $sKeyUpdate $sKeyUpdate="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates"
"Most recent update="+udfGetLatestKey($sKeyUpdate) ?
Exit 0
Function udfGetLatestKey($sKeyRoot)
Dim $iIndex,$sKey,$sHighKey,$sHighKeyDate
$sHighKeyDate=""
$iIndex=0
$sKey=EnumKey($sKeyRoot,$iIndex)
While Not @ERROR
$sKey=$sKeyRoot+"\"+$sKey
If ReadValue($sKey,"Type")="Update"
If udfFixDate(ReadValue($sKey,"InstalledDate")) > $sHighKeyDate
$udfGetLatestKey=$sKey
$sHighKeyDate=udfFixDate(ReadValue($sKey,"InstalledDate"))
EndIf
EndIf
$sKey=udfGetLatestKey($sKey)
If udfFixDate(ReadValue($sKey,"InstalledDate")) > $sHighKeyDate
$udfGetLatestKey=$sKey
$sHighKeyDate=udfFixDate(ReadValue($sKey,"InstalledDate"))
EndIf
$iIndex=$iIndex+1
$sKey=EnumKey($sKeyRoot,$iIndex)
Loop
EndFunction
Function udfFixDate($sDate)
$sDate=Split($sDate+"//","/")
$udfFixDate=Right("0000"+$sDate[2],4)+"-"+Right("00"+$sDate[0],2)+"-"+Right("00"+$sDate[1],2)
EndFunction