Thanbks for the suggestion and letting me know you like the function. This new function design does not have to bring back all names. It only brings back what you want and request. See the last example where it only brings back the DN. I think that this new code is simply more efficient when more than one name type is desired.

When I examined my logon script after Radimus opened the discussion, I notice I also caused extra traffic and deley because I had other functions calling the TranslateName UDF internally. I used primarily the DB and canonical names. There is really no need to bind to the AD more than once to get back both names. Binding is expensive and is where the delay accumulates with each occurrance.

With this change and some other function design changes, scripts can be more efficient. If you retrieve the name(s) you need and store the value early in the script, you can simply pass the value to any other function that uses the DN or Canonical name. But if you like the current functionality, you can continue to call the TranslateName UDF as many times as you like. You would just have to change the [0] array index to the number of the name type you want to use. [1] in the case DN. The error text is not longer contained in the array that is returned.

Truly, the script for some people does not need to change. The real requirement as Radimus pointed out is it usage. You should use it a little as possible and pass the resulting data.
_________________________
Home page: http://www.kixhelp.com/hb/