Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
This programs forces a replication of data from one directory to another. I use it to force the replication of the NETLOGON directory... actually the REPL$ share on the PDC, but it probably can be modified to do about anything.
Here's how it works...
FORCEREP.INI:
[DomainControllers] BDC1=dopey BDC2=sleepy BDC3=bashful
I have used this successfully on an NT workstation and I will assume it will work on a 95 WS. Don't hold me to that. You can distribute this to whoever, please just gimme the credit.
enjoy,
-DaG
FORCEREP.WBT:
; ForceRep II ; Written By David A. Grider ; 11/14/97 :BeginProgram Sounds(0) LF="%@CRLF%" SetMSL = "No" ErrorMode(@off) CurrentTime=TimeDate() CurrentDir=DirGet() WinDir=DirWindows(0) ForceRepINI="%CurrentDir%ForceRep.ini" ForceRepLOG="%CurrentDir%ForceRep.log" Drive=StrSub(CurrentDir, 1, 2) ProgVer="ForceRep v2.0" AlreadyOpen=WinExist(ProgVer) if AlreadyOpen == @TRUE then goto End WinTitle("",ProgVer) AddExtender("wwnet34I.dll") TimeOut=IniReadPvt("Main","Delay","0",ForceRepINI) Servers=IniReadPvt("Main","NumberOfServers","",ForceRepINI) Files=IniReadPvt("Main","Files","*.*",ForceRepINI) DeleteFiles=IniReadPvt("Main","DeleteFiles","No",ForceRepINI) ForceRepSource=IniReadPvt("Main","ForceRepSource","",ForceRepINI) if FileExist(ForceRepLOG) then FileDelete(ForceRepLOG) BoxOpen(ProgVer,"Preparing to start replications of NETLOGON share.") Delay(TimeOut) CheckForKey=IsKeyDown(@SHIFT) if CheckForKey == @YES ProgDebug = AskYesNo(ProgVer,"Would you like Debug Mode turned ON?") If ProgDebug == @YES Debug(@ON) ErrorMode(@ON) endif endif :FirstDriveMapping Z=1 Gosub CheckForDriveMapping SourceDrive=DriveMap1 IF SourceDrive == "" Then goto NoDrivesAvailable BoxText("Connecting to %ForceRepSource%...") MapDrive1 = netAddDrive(@default,@default,ForceRepSource,DriveMap1,@false) if MapDrive1 == @TRUE then BoxText("Successfully connected %DriveMap1% to %LF%%ForceRepSource%") AttachStatus = "Successful" Delay(TimeOut) else goto Error1 endif TimeNow=GetExactTime( ) IniWritePvt("SourceServer","Time",TimeNow,ForceRepLOG) IniWritePvt("SourceServer","MappedTo",SourceDrive,ForceRepLOG) IniWritePvt("SourceServer","UNC",ForceRepSource,ForceRepLOG) IniWritePvt("SourceServer","Status",AttachStatus,ForceRepLOG) gosub WriteBlankLine :SecondDriveMapping x=1 z=2 Gosub CheckForDriveMapping DestDrive=DriveMap2 IF DestDrive == "" Then goto NoDrivesAvailable BDC%x% = StrTrim(IniReadPvt("DomainControllers","BDC%x%","NONE",ForceRepINI)) While BDC%x% != "NONE" BDC=BDC%x% BDCUNC="\\%BDC%\netlogon" x = x + 1 BDC%x% = StrTrim(IniReadPvt("DomainControllers","BDC%x%","NONE",ForceRepINI)) EndWhile for m=1 to (x-1) BDC=BDC%m% BDCUNC="\\%BDC%\netlogon" gosub MapBDCDrives if AttachStatus == "Successful" then gosub CopyFiles TimeNow=GetExactTime( ) IniWritePvt("DomainController%m%","Time",TimeNow,ForceRepLOG) IniWritePvt("DomainController%m%","MappedTo",DestDrive,ForceRepLOG) IniWritePvt("DomainController%m%","UNC",BDCUNC,ForceRepLOG) IniWritePvt("DomainController%m%","Status",AttachStatus,ForceRepLOG) gosub WriteBlankLine Next m Goto End :MapBDCDrives BoxText("Connecting to %BDCUNC%...") MapDrive2 = netAddDrive(@default,@default,BDCUNC,DestDrive,@false) if MapDrive2 == @TRUE then BoxText("Successfully connected %DestDrive% to %LF%%BDCUNC%") AttachStatus = "Successful" Delay(TimeOut) else gosub Error2 endif Return :CopyFiles WinTitle(ProgVer, "%ProgVer% -\\%BDC% -%Files%") BoxText("Setting file attributes in %BDCUNC%") AllFiles=strcat(DestDrive,Files) FileAttrSet(AllFiles, "rash") If DeleteFiles == "Yes" then BoxText("Deleting %AllFiles%") FileDelete(AllFiles) endIf Delay(TimeOut) BoxText("Copying files to %BDCUNC%") FileCopy1=FileCopy("%SourceDrive%\%Files%", DestDrive, @FALSE) If FileCopy1 == @TRUE then BoxText("Copying of files to %BDCUNC% was successful") Delay(TimeOut) else BoxText("Errors occurred copying files to %BDCUNC%.%LF%This is most likely caused by the %LF%destination file being Read-Only.") Delay(TimeOut) EndIf netCancelCon(DriveMap2,@false,@false) Return :CheckForINI FileExist1 = FileExist(ForceRepINI) if FileExist1 == @TRUE then goto GoodToGo Pause("ForceRep II","A readable INI file does not exist. %@crlf%Please create a new INI file.") goto End :NoDrivesAvailable PlayWaveForm("Shatter.wav", 1|2|16) Pause(ProgVer,"Could not map any drives.%LF%You MUST have at least 2 drives available. Program stopping.") goto end :Error1 Pause (Progver,"An error occurred attaching %DriveMap1% to %ForceRepSource%.%LF%You must be able to attach to the PDC.") AttachStatus = "Failed" Goto End :Error2 PlayWaveForm("Shatter.wav", 1|2|16) Pause(ProgVer,"Could not map %DestDrive% to %LF%%BDCUNC%%LF%Ensure BDC is available.") AttachStatus = "Failed" Return :End netCancelCon(DriveMap1,@false,@false) netCancelCon(DriveMap2,@false,@false) BoxShut() Exit ; ================================== ; This section checks for available | ; drive mappings. | ; ================================== :CheckForDriveMapping DriveI=DiskExist("I:") If DriveI == @FALSE then DriveMap%Z%="I:" goto GotDrive endif DriveJ=DiskExist("J:") If DriveJ == @FALSE then DriveMap%Z%="J:" goto GotDrive endif DriveK=DiskExist("K:") If DriveK == @FALSE then DriveMap%Z%="K:" goto GotDrive endif DriveL=DiskExist("L:") If DriveL == @FALSE then DriveMap%Z%="L:" goto GotDrive endif DriveM=DiskExist("M:") If DriveM == @FALSE then DriveMap%Z%="M:" goto GotDrive endif DriveN=DiskExist("N:") If DriveN == @FALSE then DriveMap%Z%="N:" goto GotDrive endif DriveO=DiskExist("O:") If DriveO == @FALSE then DriveMap%Z%="O:" goto GotDrive endif DriveP=DiskExist("P:") If DriveP == @FALSE then DriveMap%Z%="P:" goto GotDrive endif DriveQ=DiskExist("Q:") If DriveQ == @FALSE then DriveMap%Z%="Q:" goto GotDrive endif DriveR=DiskExist("R:") If DriveR == @FALSE then DriveMap%Z%="R:" goto GotDrive endif DriveS=DiskExist("S:") If DriveS == @FALSE then DriveMap%Z%="S:" goto GotDrive endif DriveT=DiskExist("T:") If DriveT == @FALSE then DriveMap%Z%="T:" goto GotDrive endif DriveU=DiskExist("U:") If DriveU == @FALSE then DriveMap%Z%="U:" goto GotDrive endif DriveV=DiskExist("V:") If DriveV == @FALSE then DriveMap%Z%="V:" goto GotDrive endif DriveW=DiskExist("W:") If DriveW == @FALSE then DriveMap%Z%="W:" goto GotDrive endif :GotDrive Return :WriteBlankLine OutPutFile = FileOpen(ForceRepLOG, "APPEND") HeaderInfo = " " FileWrite(OutPutFile, HeaderInfo) FileClose (OutPutFile) Return
Article ID: W13794
Filename: Replicate Data from one Directory to Another.txt
File Created: 2001:03:01:12:47:38
Last Updated: 2001:03:01:12:47:38