====== Migrate Windows Fileserver using Robocopy ======
Migrate [[:wiki:windows:server:fileserver|Windows Fileserver]] using [[https://en.wikipedia.org/wiki/|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 =
robocopy $source $destination /e /zb /copy:DATSOU /r:3 /w:3 /log:c:\RoboCopy\Logs\.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 **D**ata, **A**ttributes, **T**ime Stamps, **S**ecurity, **O**wner, a**U**diting 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\.log /V /NP
- Afterwords, don't forget to re-share the folder / drive, and change the source on the DFS.