Question : Network drive mapping batch file that passes domain username/password

Experts,

I have a need for a batch file that can be executed while the user is connected via VPN to the office network. This batch file must map a few generic shares and then the user's home folder. After some research I wrote up the following:

if exist z: net use z: /delete
if exist y: net use y: /delete
if exist t: net use n: /delete

net use z: \\192.168.10.252\Share1 /persistent:No
net use y: \\192.168.10.252\Share2 /persistent:No
net use t: \\192.168.10.252\users$\(users username) /persistent:no /u:domain\username password


To answer a few of the potential questions - I used the IP address rather than the hostname of the server to avoid having any DNS issues. I originally tried using the %username% variable but changed to using the actual username since I will have to have an independent file for each user that stores their credentials (not a big problem, small office with only ~3 users who would need this capability).

The paths are all correct, if I were to do start>run with the path to the home folder and type in his credentials it works fine. Just can't seem to convince the batch file to pass that info correctly.

OS is XP, server is WS2008, VPN client is Cisco.

Answer : Network drive mapping batch file that passes domain username/password

Random Solutions  
 
programming4us programming4us