Solved

Write a script to Map a Network Drive

Posted on 2012-03-25
7
667 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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 80

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The main issue when installing Vista and XP in dual boot is when you have to reinstall any of the two when something fails, let's say a hard disk failure, a lost partition, virus, etc. What commonly happens is that you lose all your hard work config…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
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…

730 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