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

Samples from Users

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

AD Syncronization


Question:

I'm trying to sync my AD after some modifications to objects. I can get it to work with the following VB script, but can't figure it out in winbatch.

Can someone help me out here? I'm sure lots of people can use this one! Think of not needing replmon to cross site boundaries..

Dim TargetServer
Dim SourceServer
Dim NamingContext

SourceServer="server"
NamingContext="DC=My,DC=Domain,DC=de"

Set DLL=CreateObject("IADsTools.DCFunctions")
DLL.SetReplicaSyncAllFlags=("DS_REPSYNCALL_PUSH_CHANGES_OUTWARD,DS_REPSYNCALL_CROSS_SITE_BOUNDARIES")
Result=DLL.ReplicaSyncall(Cstr(SourceServer),Cstr(NamingContext),1,0)
if result=-1 Then
Wscript.Echo "The error returned was: " + DLL.LastErrorText
else
Wscript.Echo "The command completed successfully."
end if
NOTE: The windows 2000 support tools (on the installation CD) need to be installed, and the iadstools.dll needs to be registered.

Answer:

Here is the WinBatch code to Syncronize Active Directory:
SourceServer="server"
NamingContext="DC=My,DC=Domain,DC=de"

objDCFunctions=CreateObject("IADsTools.DCFunctions")
objDCFunctions.SetReplicaSyncAllFlags="DS_REPSYNCALL_PUSH_CHANGES_OUTWARD,DS_REPSYNCALL_CROSS_SITE_BOUNDARIES"
result=objDCFunctions.ReplicaSyncall(SourceServer,NamingContext,1,0)
if result == -1 
   Message("ReplicaSyncall",StrCat("The error returned was: " , objDCFunctions.LastErrorText ) )
else
   Message("ReplicaSyncall", "The command completed successfully.")
endif
objDCFunctions = 0

Article ID:   W16327
File Created: 2005:02:18:12:19:48
Last Updated: 2005:02:18:12:19:48