Radimus:

Sorry - I know you were proud of that code snippet, but it keeps returning an 87 error.. I replaced it with the original code and now it works fine. Your logic looks reasonable - I don't know why the error is coming back.
Code:
 
For Each $objInstance in $objEnum
If $objInstance
$ = Execute(Chr(36) + 'sValue = ' + Chr(36) + 'objInstance.' + $sWhat)
; $tmp = $tmp +'|' + iif(VarType($sValue) & 8192,join($sValue,'|',ubound($sValue)),$sValue)
if VarType($sValue) & 8192
For Each $sItem in $sValue
$Tmp = $Tmp + '|' + Trim($sItem)
Next
else
$Tmp = $Tmp + '|' + Trim($svalue)
Endif
EndIF
Next



The script where I'm using this is very large (8600+ lines to date) and has extensive error checking. The intermediate calling UDF was seeing the 87 error come back and created an empty array to return to the main routine.

Both the secure (with credentials) and unsecure forms are now returning data properly without error. As I said - the UDF always returned the proper data, but something in the IIF and JOIN was generating an error 87, which was being returned by the UDF.

NTDoc and I had some serious challenges using IIF last week - the only way we were able to resolve it was to code the traditional If/Else/EndIf. I think IIF is buggy when you place functions or statements in the returned values.

You could probably replace the For/Each with the Join, but I haven't seen an array returned by anything I query, so I don't have a way to test it.

Anyway, I'd be happy if you update your WMIQuery post with the security now that it works, and I'll delete this post (or the moderator could move it to Scripts) for further discussion on the IIF issue.

Glenn

_________________________
Actually I am a Rocket Scientist! \:D