Solved

Write a script to Map a Network Drive

Posted on 2012-03-25
7
661 Views
Last Modified: 2012-03-26
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
0
Comment
Question by:rangersal1
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:l33tf0b
ID: 37764443
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.
0
 

Author Comment

by:rangersal1
ID: 37764462
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?
0
 
LVL 16

Expert Comment

by:l33tf0b
ID: 37764512
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).
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:rangersal1
ID: 37764624
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.
0
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 37766161
net use s: https://myfiles.gccaz.edu/shared  password /user: gccaz\rplalaz3

it must be in the format shown
net use Z: \\servername\sharename password /user:username

open notepad copy the first line into a new document
save the document as "mystartup.bat"
from explorer right click on startup.bat select create shortut
select the shortcut right click select cut
press the windows key or click on the start button
select all programs
scroll down to startup
right click and open
on a blank spot select paste
0
 

Author Comment

by:rangersal1
ID: 37766334
That was it thank you.
0
 
LVL 16

Expert Comment

by:l33tf0b
ID: 37766448
i don't see how different that was from my post... aside from substituting the actual info.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many reasons a PC runs slower than when it was new, ranging from malicious software intended to mess things up to simple general Windows use.  Your PC performance may slowly degrade over time without you noticing but when you buy a PC from…
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now