robocopy use

8 Sep

The Directory Replicator Service that is provided by Windows NT Server requires exclusive access to Netlogon and REPL$. When it doesn’t get exclusive access, replication fails.

A better way to replicate is to use the ROBOCOPY utility from the

Unlike the Replicator Service, ROBOCOPY can replicate any number of directories, handle very large files, and doesn’t require exclusive access. ROBOCOPY /? returns:

ROBOCOPY v 1.71 : Robust File Copy for Windows NT (from Supplement Two)

Usage : ROBOCOPY source destination [file [file]…] [options]
source : Source Directory (drive:\path or \\server\share\path).
destination : Destination Dir (drive:\path or \\server\share\path).
file : File(s) to copy (names/wildcards – default is “*.*”).
/S : copy Subdirectories, but not empty ones.
/E : copy subdirectories, including Empty ones.
/R:n : number of Retries on failed copies – default is 1 million.
/W:n : Wait time between retries – default is 30 seconds.
/REG : Save /R:n and /W:n in the Registry as default settings.
/X : report all eXtra files, not just those selected.
/V : produce Verbose output, showing skipped files.
/L : List only – don’t copy, timestamp or delete any files.
/ETA : show Estimated Time of Arrival of copied files.
/MOVE : Move files and dirs (delete from source after copying).
/PURGE : delete dest files/dirs that no longer exist in source.
There are at least 4 ways that you can use ROBOCOPY to do your replication:
1. A manually invoked batch file:

robocopy \\\admin$\system32\repl\export\ \\\admin$\system32\repl\import /s /v /r:1 /w:1 /eta
robocopy \\\admin$\system32\repl\export\ \\\admin$\system32\repl\import /s /v /r:1 /w:1 /eta
NOTE: and are the names of the computers being synchronized.
The first time that you replicate, use SCOPY to preserve permissions and then use ROBOCOPY which will maintain the permissions.

2. You can cause the above batch file to continuously loop:

:LOOP
robocopy \\\admin$\system32\repl\export\ \\\admin$\system32\repl\import /s /v /r:1 /w:1 /eta
robocopy \\\admin$\system32\repl\export\ \\\admin$\system32\repl\import /s /v /r:1 /w:1 /eta
Sleep 1800
goto LOOP
Sleep is a Resource Kit utility. The above sleeps for 1800 seconds,