Skip navigation

JSI Tip 0609 - A better way to replicate.

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 \\<SourceServer1>\admin$\system32\repl\export\ \\<SourceServer1>\admin$\system32\repl\import /s /v /r:1 /w:1 /eta 
robocopy \\<SourceServer1>\admin$\system32\repl\export\ \\<DestinationServer1>\admin$\system32\repl\import /s /v /r:1 /w:1 /eta
NOTE: <SourceServer1> and <DestinationServer1> 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:

robocopy \\<SourceServer1>\admin$\system32\repl\export\ \\<SourceServer1>\admin$\system32\repl\import /s /v /r:1 /w:1 /eta 
robocopy \\<SourceServer1>\admin$\system32\repl\export\ \\<DestinationServer1>\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, ½ hour.

3. Schedule the batch file from number 1.

The schedule service runs under the context of the system account which is local and has no network access. Create a new user account that is a member of the domain admin group with a non-blank, non-expiring password. In user manager for domains, give it all the advanced rights it may ever need including logon as a service and batch job.

In control panel services, stop the schedule service. Configure it to start automatically and to use this new account. Start the scheduler service.

AT 12:00AM /every:m,t,w,th,f,sa,su <Drive:>\Folder\replicate.bat
AT 08:00AM /every:m,t,w,th,f,sa,su <Drive:>\Folder\replicate.bat
AT 12:00PM /every:m,t,w,th,f,sa,su <Drive:>\Folder\replicate.bat
AT 08:00PM /every:m,t,w,th,f,sa,su <Drive:>\Folder\replicate.bat

4. Run it as a service

You can use the batch file from number 2 and Instsrv.exe to create the regiistry entries for the SRVANY service. These utilites are also from the Resource Kit.


You use the /purge option to delete files on the destination that have been removed from the source if you wish to emulate this replicator service function.

You may wish to limit the default retries as the destination files may be in an open status. Using /R:5 /W:5 will timeout faster.

If you pipe the output, check that your log file isn't consuming too much space.

You can run ROBOCOPY on any machine, even a Workstation. It does not have to run on the source or destination computer.

If absolute symmetry between the source and destination directories is needed, the /purge, /e, /t, and event /is switches can be used. See the online help and the Robocopy.wri file, you may not need to be this exacting.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.