Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
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.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


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

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
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…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

564 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