Quote:

The problem is that the WMI action will return '0' to indicate success, thus if someone checks for the UDF return but not the @ERROR, it'll evaluate to 'success' even though the action failed




Eh? What do you mean?

Both the exit value and the function value are set to @ERROR wether the error is set by the initial creation of the object or the enumeration.