Im a trying to create a script that checks to see it a particular version of software is installed. If it is not up to date then it installs the program.

I am having some trouble listing the registry key's in the uninstall hive. here is my code


$Version = "10.19"

Dim $UninstallKey, $AppKey, $KeyIndex, $Key, $Keys, $KeyExist
$KeyExist = 0
$UninstallKey = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
$KeyIndex=0

While @ERROR = 0
$AppKey = EnumKey($UninstallKey, $KeyIndex)
$KeyIndex = $KeyIndex + 1
$Keys = $Keys + $UninstallKey + '\' + $AppKey

$rc = RedirectOutput("test.log",overwrite)
If @ERROR = 0
"Name found: $AppKey"?
Endif

While $KeyExist = 0
$ValueName = ENUMVALUE ($Keys, $Index)
$KeyExist = KeyExist("$AppKey + $ValueName")
$Index = $Index + 1

If $KeyExist = 0
"$AppKey: $ValueName"?

EndIf
Loop
Loop