ok, starting from up, first problem seemed to be:
code:
$sysinfo=CreateObject("adsysteminfo")
IF Len($sysinfo) > 0

the same thing as with outputting it to console.
if $sysinfo has an object (successfull creation) you will get this error.
len() is function for checking string lengths.
objects have no string lenghts.
as you place it in as string, the len tries to translate the object to string-valuetype and thus the error.

more proper way would be:
code:
$sysinfo=CreateObject("adsysteminfo")
IF @error
"couldn't create object: @error, @serror"
exit 1
endif

which stops the UDF execution when error occurs, otherwise execution is continued.
_________________________
!

download KiXnet