Previous steps:

  • Configure VPN

Configuring Robocopy:

Open a new text file in Notepad on either of the servers.

We will be connecting through the VPN to either shares. Depending on what side you will be running this from you will need to know the opposite server’s local IP and have credentials to the share/directory, or you can edit the permissions on the directory to allow Everyone to make it easier. 

Type the following command, this would be if you are going to be using specific credentials so you don’t open the share to everyone

  • Net use \\xxx.xxx.xxx.xxx\(drive letter)$ /user:username password
  • I.E. net use \\192.168.1.1\c$ /user:admin pass123

Now hit enter twice and on the following lines you will configure the lines that start what you will be transferring. You can either do full directories and keep it to one line, or you would have to repeat this for each and every directory you want to do separately.

  • The basic syntax is robocopy <Source> <Destination> [options]
  • To get a full list of the option switches, Technet and SMCCME have some examples.
  • Here is an example of how you would configure it with some filter options applied. By no means are you restricted to these settings, this is just an example of a working script. You would use the articles referenced above to create your own custom script. 
  • robocopy "\\192.168.xxx.xx\redirected$\user\documents" "C:\home\xxx\user\Documents" /E /DCOPY:T /ZB /w:1 /r:1 /XO /XF *.ost *.lnk *.pst *.bak
  • The first quotation is the source directory, the second quotation is the destination.
  • /E -----Copies all subdirectories even empty folders
  • /DCOPY:T -----Copies the files with the original timestamps
  • /ZB -----Uses Restart mode. If access is denied, this option uses Backup mode. Meaning if the users is currently access the files, it will be skipped and tried again once it is accessible. 
  • /W:1 ---- Wait times on retries.
  • /R:1 ---- How many retries. 
  • /XO ---- Exclude older files, so this would always copy over the latest version and overwrite the old version on the destination. 
  • /XF *.ost ----This and the couple last entries are just extensions of files set to be excluded over. These are optional and just included as to how you can apply it. /XF being the main trigger, then *.extension would exclude any files ending with that extension.

Once completed go to “File” on the top left and choose “Save As”.

Choose a location and at the end of the file name add “.bat” to the end of it and change the file type to “all files”, then click “Save”. This will save the text file as a batch file.  

Run the batch file and it will begin the transfer of the files to your configuration. 

Related articles: 

Data Migration

Did this answer your question?