Need help with script to automatically add credentials to a mapped drive/external drive

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
I am currently using a robocopy script to backup data to an external drive.  I mapped the drive in Win 7 and it works but after a reboot, it will not remap it unless the credentials are put back in even if I tell it to "remember password.  Is there something I can add to the robocopy script that remaps the drive with the correct credentials so the user can then backup his machine to this external drive?  

Thanks in advance!
Question by:vianceadmin
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
LVL 17

Accepted Solution

Mike_Carroll earned 1000 total points
ID: 26287987

X: with the drive letter you need
SERVER with the network name of the PC you are mapping to
SHARE with the name of the network share on that PC
PASSWORD with the users password
USERNAME with the username

keep the rest and off you go... (c:
LVL 66

Assisted Solution

johnb6767 earned 1000 total points
ID: 26288197
Dot even need the Drive mappings....
net use \\server PASSWORD /User:domain\Username
Same difference though really.....Except this way will not create the X Drive mapping, so you dont jneed to worry about deleting it when trying to reauthenticate, in the event it is remembered....

Expert Comment

ID: 26291918
Can you give the user access to the external drive using domain permissions, or define the user's accountname on the external drive? That way you don't have to enter a password in a script, which is bad in two ways: users can get access to the script and know your password, and if you change your password, the script doesn't work anymore.
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 26292930
When I run the command NET USE X: \\SERVER\SHARE PASSWORD /USER:USERNAME it asks me if I wnt to overwrite the remembered connection.  I want the script to automatically connect so the user doesn't get prompted.  I guess I could always use the net use \\server PASSWORD /User:domain\Username instead

Author Comment

ID: 26292938
Ended up using the net use \\server PASSWORD /User:domain\Username script and changing the location in the robocopy script to \\server instead of the drive letter of the mapped drive.  Works great.

Will split the points between the two...
LVL 66

Expert Comment

ID: 26300450
Glad it worked....

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

801 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