Link to home
Start Free TrialLog in
Avatar of rangersal1
rangersal1Flag for United States of America

asked on

Write a script to Map a Network Drive

I have a laptop running Vista with all updates.  I am using a mapped network drive.  With Vista, every time I restart my computer I have to re-map the drive.  So I am looking for a way to run a script. The network drive is located on the server at my work.  The path is similar to this. I want to name the drive S: and the path is

https://myfiles.gccaz.edu/shared.  username and password is used for loggin and the box is checked for re-connect at loggin. I have attached the pdf used for a guide.
vistasdrive10sdrive.pdf
Avatar of Raymond Peng
Raymond Peng
Flag of United States of America image

you could right a batch file in notepad > rename ext from .txt to .bat and put it in your startup / logon script

net use Z: \\servername\sharename password /user:username

or just

net use  Z: \\servername\sharename

and see if it prompts you for credentials.
Avatar of rangersal1

ASKER

Ok I wrote the batch file and was prompted for the usernam then the password. How can I get that in the file and exactly where do I put it at in the startup script?
net use Z: \\servername\sharename password /user:username

are you in a domain environment or do you log on locally to your machine?

if locally, you could do this:

Create a shortcut to the batch file.
Once the shortcut has been created right-click the file and select Cut.
Click Start, Programs, right-click the Startup folder and click Open
Once the Startup folder has been opened click Edit and paste the shortcut into the startup. Any shortcuts in the startup folder will automatically start each time Windows starts.

referenced from here: http://www.computerhope.com/issues/ch000322.htm

if domain, you'll need to find out where the startup folder is kept (might not be the same).
it keep prompting me for the user name. Here is the code:

net use S: https://myfiles.gccaz.edu/shared\gccaz\rpsalaz3/mypassword

net use S: https://myfiles.gccaz.edu/shared  is what I used with the first set of instructions.

gccaz\rpsalaz3 is my username.
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That was it thank you.
i don't see how different that was from my post... aside from substituting the actual info.