Alternatives to the Directory Replicator ServiceLast reviewed: July 8, 1997Article ID: Q160513 |
The information in this article applies to:
SUMMARYMicrosoft Windows NT provides a service that is designed to replicate logon scripts between domain controllers in a domain. Logon scripts were first introduced with the Microsoft LAN Manager product, and, although Windows NT provides peer-level server capabilities and user profiles that provide far more configurability of the desktop and user settings, logon script replication is still supported for command-line execution and down-level clients. The alternatives mentioned in this article resolve several issues with the Replicator service, such as:
MORE INFORMATIONThe Microsoft Resource Kit provides a robust copy utility called Robocopy.exe. This utility can be used for very large transfers and synchronizations with large amounts of data and individual files. This command can be launched in several ways, and below are some methods that can be used as alternatives to the Replicator service. For more information on the Robocopy.exe command, see the online help (type "robocopy /?") and the Robocopy.wri file included in the Resource Kit. Below is a summary of the syntax used in this document. ROBOCOPY v 1.54 : Robust File Copy for Windows NT 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.
Method 1A batch file can be created and simply run when changes have been made to the source files and synchronization is needed between the domain controllers. An example of such a batch file is below. Because of word- wrap, each grouping of lines is actually one line in the ASCII BAT file.
robocopy \\<computer1>\admin$\system32\repl\export\ \\<computer1>\admin$\system32\repl\import /s /v /r:1 /w:1 /eta robocopy \\<computer1>\admin$\system32\repl\export\ \\<computer2>\admin$\system32\repl\import /s /v /r:1 /w:1 /etaNOTE: <computer1> and <computer2> are the names of the computers being synchronized.
Method 2The above BAT file can be made to run in a loop, pausing for a specified amount of time between each copy. Another Resource Kit utility called Sleep.exe can be used to specify the number of seconds for the delay between synchronizations. This BAT file could be placed in the Startup group, always run, and minimized on the desktop. To ensure access to each remote domain controller, Sleep.exe should be run under the user context of an administrator. Below is an example of such a BAT file. Because of word- wrap, each grouping of lines is actually one line in the ASCII BAT file.
:loop robocopy \\<computer1>\admin$\system32\repl\export \\<computer1>\admin$\system32\repl\import /s /v /r:1 /w:1 /eta robocopy \\<computer1>\admin$\system32\repl\export \\<computer2>\admin$\system32\repl\import /s /v /r:1 /w:1 /eta sleep 1800 goto loopNOTE: <computer1> and <computer2> are the names of the computers being synchronized. If file permissions must be maintained on the files, use SCOPY, another resource kit utility. As Robocopy is more robust, Scopy could be used for the initial replication of NTFS permissions, and then Robocopy can be used for the regular replication, if the permissions are not changed on a regular basis and the directory tree structure is fairly static. If less granular permissions are acceptable, move away from NTFS file security and towards the lower granular security implemented with share permissions. This may reduce the amount of administration required and eliminate the need for replicating file permissions.
Method 3Another method to maintain directory structures remotely can be to schedule a batch file using the Scheduler service. Services provide the benefit of allowing for synchronization independent to the user logged on, and when a user is logged on, there is no minimized icon that could be accidentally terminated. As with any access to a remote machine over the network, the user-context of the process must have the necessary read or write permissions. To do this, the Scheduler service needs to be started with a user account instead of the local system account. If more than one synchronization is desired each day, each occurrence requires a separate statement. The BAT file presented in Method 1 above can be used as an example, and the following statements can be used to configure the Scheduler service to establish synchronization at the desired intervals.
AT 12:00AM /every:m,t,w,th,f,sa,su c:\bin\replicate.bat AT 08:00AM /every:m,t,w,th,f,sa,su c:\bin\replicate.bat AT 12:00PM /every:m,t,w,th,f,sa,su c:\bin\replicate.bat AT 08:00PM /every:m,t,w,th,f,sa,su c:\bin\replicate.batWith the /every switch, the Scheduler service records the frequency and initiates the jobs with no more administrator intervention. To verify the status of the Scheduler service, type AT at the command prompt. To test the BAT file with the Scheduler service, the /interactive switch can be use to see output from Robocopy, or the output can be redirected to a file as mentioned below.
Method 4In the interest of completeness, one final method can be discussed. The BAT file displayed in Method 2 above, which uses the SLEEP command to regulate the synchronization interval, can be launched as a user created service. This provides the usual benefits of running as a service, and also the benefit of there being a single thread of execution with the single BAT file. Although unlikely, if the Scheduler service were used to regulate the interval instead of the SOON command, and if Robocopy were to fail during the file synchronization, launched processes could accumulate without completing, as the Scheduler service does not track launched processes after they are run. The BAT file in Method 2 could be used along with the Instsrv.exe command to create the registry entries for the Srvany.exe service from the Resource Kit. See online help and the Resource Kit Help file for the particular syntax and instruction.
Robocopy Notes
|
Keywords : kbenv ntdomain ntreskit NTSrvWkst kbenv
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |