Al,
Even on a machine with 2GB or RAM I'm not getting the correct results. It appears to be correct for systems with 1GB or less of Memory though.
Here is the code I modified to support a remote machine.
memory('mytestserver')
Code:
function memory(optional $fTarget)
dim $hexdmp, $hex, $counter, $hexvals, $memkey, $vals
If ($fTarget) $fTarget = IIf("\\" = Left($fTarget,2),$fTarget,"\\" +$fTarget) + "\" EndIf
$memkey=$fTarget+"HKLM\hardware\resourcemap\system resources\physical memory"
$hexdmp=readvalue($memkey,".Translated")
for $start = 1 to len($hexdmp) step 8
$hex=""
for $counter = 0 to 7 step 2
$hex=substr($hexdmp,$start + $counter,2)+$hex
next
if $hexvals=""
$hexvals=$hex
else
$hexvals=$hexvals + "|" + $hex
endif
next
$vals=split($hexvals,"|")
for $counter= 8 to ubound($vals) step 4
$nul=execute("$$memory=0.0 + $$memory + &"+$vals[$counter]+"/1024")
next
$memory=int(($memory +648)/1024)
endfunction