Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


July 22, 1998

JSI Tip 0609 - A better way to replicate.

RSS
Subscribe to Windows IT Pro | See More Tips Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!


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:

 
: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.

NOTES:

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.

End of Article



Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Battery Life Issues Almost Certainly Not Windows 7's Fault

While Microsoft is still investigating a notebook battery life issue that was supposedly caused by Windows 7, some interesting trends have emerged. ...

Confirmed: Battery Life Issues Not Windows 7's Fault

Microsoft on Monday issued a lengthy statement about the recent Windows 7 battery controversy, echoing my assessment from earlier in the day, but backing it up with hard, cold evidence. Put simply, Windows 7 is not responsible for any battery life issues ...

Getting your iPhone to Sync with Exchange 2003

Follow these steps to use an iPhone with Exchange. ...


Related Events 7 Ways To Get More From Your SharePoint Deployment Now

Check out our list of Free Email Newsletters!

Related Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2010 Penton Media, Inc. Terms of Use | Privacy Statement