Well... you are probably correct that 90% of the time the local DC will be the logon server. That confuses me as you recognize this but yet in your second example, you still use @LDrive.

Also in an attempt to ascertain what subnet you're in, you check for a sub-string of the IP. Be aware of the following:

Syntax for SubStr(). You need to specify start, length.

@IpAddressx() will pad out the octect to three positions each (plus the dot).

Check out our UDF section. There are some well written UDFs that will do what you want.

While it is possible to SHELL out to batch files, I encourage you to translate the batch file to KiX and run it in-line.

Check out the FAQ on the use of SHELL and RUN.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.