This all sounds like a DNS/Wins/Hosts file issue to me. The client probably can't find the Domain Controller, or some other server that your scripts are linked to. I have used the following trick to "fix" VPN issues before with some success:
Domain Browsing with LMHOSTS
Without WINS, you need special LMHOSTS entries that designate who all the
domain controllers are. This is done in the following convention:
199.199.199.1 ComputerName #PRE #DOM:DomainName
When a computer is booted, it reads these entries and store them permanently
in the NetBIOS name cache until the computer is powered down. (Because of
this, it is best that these entries are last in the LMHOSTS file, for
subsequent LMHOSTS parsing efficiency.) All computers in the domain needs
one of these entries for each domain controller (in the local domain), as
well as one for the PDC. Also note the exact order of #PRE #DOM, and that
they are capitalized. The other names are not case sensitive.
BTW, the GetPrimaryGroup() UDF is using ldap.