Let's start with what InContainer() actually does. InContainer calls TranslateName() binding to the global catalog (GC:). Notice that the first parameter used in the TranslateName call is '3'. The documentation for the TranslateName() UDF shows that you can use 1, 2, or 3 for the first parameter which controls where the function binds.

Depending on the health of your infrastructure the replication of data from domains to the GC may be compromised.

Try this:
Code:

Break on

$rc = SetOption("Explicit", "ON")
$rc = SetOption("NoVarsInStrings", "ON")
Dim $DN, $start

; This binds to the GC:
$start=@ticks
? "bind to GC"
$DN = TranslateName (3, "", 3, @domain + "\" + @wksta + "$", 1)
? $DN[0]
? "Elapsed Time: " + (@ticks-$start) + " ticks"
?

; This binds to a Logon domain DC:
$start=@ticks
? "bind to server: " + substr(@Lserver, 3)
$DN = TranslateName (2, substr(@Lserver, 3), 3, @domain + "\" + @wksta + "$", 1)
? $DN[0]
? "Elapsed Time: " + (@ticks-$start) + " ticks"
?


; This binds to the domain where the computer account resides.
$start=@ticks
? "bind to " + @domain
$DN = TranslateName (1, @domain, 3, @domain + "\" + @wksta + "$", 1)
? $DN[0]
? "Elapsed Time: " + (@ticks-$start) + " ticks"
?
exit 1



For the server and domain values, try to hard code some specific server names and domain names throughout your environemnt.

Does the script always return the expected DN? Remember to include the TranslateName UDF in the script.
_________________________
Home page: http://www.kixhelp.com/hb/