Migrate Windows Fileserver using Robocopy
Migrate Windows Fileserver using Robocopy
- In your new server.
- Go to your C:\
- Make a folder called “RoboCopy”
- Inside “RoboCopy” make a new folder called “Logs”
- Inside “RoboCopy” mae a new folder called “Old Logs”
- As filename I usually use the folder / drive I'm migrating.
- Insert the following code into the *.ps1
$source = <\\OLDSERVER\d$\FOLDER> $destination = <D:\FOLDER> robocopy $source $destination /e /zb /copy:DATSOU /r:3 /w:3 /log:c:\RoboCopy\Logs\<FOLDER>.log /V /NP
What are those switches doing?
- /E Copy subdirectories recursively, (including empty ones.)
- /ZB Use ‘restartable’ mode, and if this fails use ‘backup’ mode.
- /copy:DATSOU Copy Data, Attributes, Time Stamps, Security, Owner, aUditing information
- /R:3 Retry three times, if you don’t specify this, it will retry one million times!
- /W:3 Wait time between the retries above.
- /log Will output the log to the folder we created above.
- /V Produce output in verbose (detailed) mode.
- /NP Do not show percentage progress
- After the first run, run the following code to mirror just changes from the old to the new server, usually doing off-work hours.
robocopy $source $destination /e /zb /copy:DATSOU /MIR /r:3 /w:3 /log:c:\RoboCopy\Logs\<FOLDER>.log /V /NP
- Afterwords, don't forget to re-share the folder / drive, and change the source on the DFS.