WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Networks - Servers
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Replication Manager - Replicate BDCs

Keywords: 	  copy BDCs replicate domains  copy domains duplicate domains

I have worked in large environments with the BDC's number over 100..

It's been a pain to add, change, delete and verify consistency of replication information across all domain controllers.

Finally, I figured out how to automate adding all BDC's in a domain to the PDC's Export List.. and subsequently.. adding the import info consistently across all the bdc's ..

Comes in handy for knowledge consistency when a NEW bdc is placed into production.. or a BDC is promoted to the PDC..

You have to manually configure at least ONE bdc.. this script will then "copy" it's replication settings to all the other BDC's..

Please use its power for good, not evil..

Signed..

Professor X.


dll=strcat(dirwindows(1),"netapi32.dll")
func="NetReplGetInfo"
newfunc="NetReplSetInfo"
lvl=0
dllker=strcat(dirwindows(1),"kernel32.dll")
copymem="RtlMoveMemory"
getlen="lstrlenW"
servers=""

;get pdc name
serv=wntgetdc("","",1)

:pdcsetinfo
mark=0
gosub getdclist
gosub getbuffers
gosub getinfo
gosub fillnewbuff
gosub setservptr
gosub setinfo
binaryfree(bbinput)



:getbdcinfo
mark=mark+1
gosub getclonebdc
gosub getbuffers
gosub getinfo
gosub fillnewbuff

for yy= 1 to numdc
	mark=mark+1
	serv=itemextract(yy,looplist,@tab)
	gosub getbuffers
	gosub fillnewbuff
	gosub setinfo
next yy
exit

:getbuffers
bbserv=binaryalloc(50)
binarypokestr(bbserv,0,serv)
binaryconvert(bbserv,0,3,0,1)

;establish return buffer
if mark < 2
	bbdata=binaryalloc(3000)
	binaryeodset(bbdata,3000)
end if
return


:getinfo
;call function
rc=dllcall(dll,long:func,lpbinary:bbserv,long:lvl,lpbinary:bbdata)
if rc==0 then location=binarypeek4(bbdata,0)
binaryfree(bbdata)
return

:fillnewbuff
bbnewbuff=binaryalloc(200)
binaryeodset(bbnewbuff,200)
if rc==0
	for x = 0 to 100 by 4
		data=IntControl (32, location + x, "LONG", 0,0)
		binarypoke4(bbnewbuff,x,data)
	next x
end if
return


:getdclist
newservers=wntServerList("", "", 16)
looplist=newservers
newservers=strreplace(newservers,@tab,";")
newservers=strreplace(newservers,"\\","")
numdc=itemcount(looplist,@tab)
return

:setservptr
bbinput=binaryalloc(strlen(newservers)*3)
binarypokestr(bbinput,0,newservers)
binaryconvert(bbinput,0,3,0,1)

bbaddress=intcontrol(42,bbinput,0,0,0)
binarypoke4(bbnewbuff,8,bbaddress)
return

:setinfo
rc=dllcall(dll,long:newfunc,lpbinary:bbserv,long:lvl,lpbinary:bbnewbuff,long:0)
if rc==0 then message("Replication Manager","Information for %serv% has been successfullly updated.")
binaryfree(bbserv)
binaryfree(bbnewbuff)
return


:getclonebdc
sourcecfg=askline("Source Import Computer","Enter Computer name to copy import configuration%@crlf%(Hint:A BDC is best)","")
if strsub(sourcecfg,1,2)!="\\" then serv=strcat("\\",sourcecfg)
serv=strupper(sourcecfg)
return


Article ID:   W14873
File Created: 2001:11:08:12:40:44
Last Updated: 2001:11:08:12:40:44