Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Network drive mapping batch file that passes domain username/password

Avatar of Pro4ia
Pro4ia asked on
NetworkingVPNWindows Batch
5 Comments1 Solution932 ViewsLast Modified:

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: \\\Share1 /persistent:No
net use y: \\\Share2 /persistent:No
net use t: \\\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.
Avatar of TheQuietShadow
TheQuietShadowFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers