function GetInstalledsoftware(optional $machine)
Dim $root, $softwarekey, $index
dim $temparray[10]
if not $machine
$root = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
else
$root = "\\" + $machine + "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
endif
$SoftwareKey = enumkey($root,$Index)
while not @error
$DisplayName = readvalue($root + $SoftwareKey, "displayname")
$DisplayVersion = readvalue($root + $SoftwareKey, "DisplayVersion")
if $DisplayName
if $count > ubound($temparray)
redim preserve $temparray[ubound($temparray)+10]
endif
$temparray[$count] = $DisplayName +" "+ $DisplayVersion
$count = $count + 1
endif
$Index = $Index + 1
$SoftwareKey = enumkey($root, $Index)
loop
if $count > 0
redim preserve $temparray[$count-1]
else
$temparray = ""
endif
$getinstalledsoftware = $temparray
endfunction