Robocopy to an Internal (Home) Server - Password Protected

Here is there the original files are:
C:\Users\coreybryant\Documents\Medical\Medical Records

Now I would like to robocopy them over to this protected server (yes I have the user / pass).

I found a few things in forums, some say create a .bat, some say don't.  

The copy of where I would like these to be place in:
\\Nas01\coreybryant\Medical Records

There are no folders to deal with or anything.  

I found Running Robocopy command remotely,
psexec.exe -u "DOMAIN\DOMAIN USER" -p "PASSWORD" cmd.exe /c Robocopy "C:\Documents and Settings\%username%\Application Data\Microsoft\Outlook" "\\server\servershare\%username%\Application Data"

I tried:
robocopy "C:\Users\coreybryant\Documents\Medical\Medical Records" "\\Nas01\coreybryant\Medical Records username" -p "password"

ERROR : Invalid Parameter #3 : "-p"

I don't know if I should use that psexec or not.

Thank you!
LVL 29
Who is Participating?
Create a batch file with the following content:
net use "\\Nas01\coreybryant\Medical Records\IPC$" "TheTopSecretPasswordInDoubleQuotes" /user:SomeUser
robocopy "C:\Users\coreybryant\Documents\Medical\Medical Records" "\\Nas01\coreybryant\Medical Records"
net use "\\Nas01\coreybryant\Medical Records\IPC$" /delete

Open in new window

Sushil SonawaneCommented:
Try Microsoft File server migration toolkit. It's easy for migration and GUI base.

Download link is below mention.

why do you put credentials in robocopy command? What happens if you remove it?

For Example:
robocopy "C:\Users\coreybryant\Documents\Medical\Medical Records" "\\Nas01\coreybryant\Medical Records"

Open in new window

coreybryantAuthor Commented:
Thanks, I decided to use this one - it seemed to be the easiest
P.S. it would be better to store credentials in cmdkey.exe then in plaintext batch

cmdkey /add:Nas01 /user:user /pass:yourpassword

you can then use oBdA's script (just remove user name and password) without risk of uncovering your password by someone else.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.