I'd still like to know what error you are receiving. The UDF will return an array if the query was successful, but if errors occur during initialization of the WMI object, the return value will be undefined. That's why checking for a UBound seems to work - the return is not an array when errors occur.

Allen's solution works around the issue but does not identify or respond to the problem. The correct method of using this type of function is
 Code:
$aResult = WMIQuery(args...)
If @ERROR
  ; error occurred - decide if default data can be used (ie - create an empty array 
  ; with the expected number of elements) or an error handler routine is needed.
Else
 ; No error - process the results
EndIf
Checking for the correct number of elements in an array returned from a function is always a good idea, but is not a substitute for proper error checking and handling.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D