-
April 7th, 2005, 05:04 AM
#1
force ADAM replication
I believe the DsReplicaSyncAll function in ntdsapi.dll and the ReplicaSyncAll function in iadstools.dll can force replication programmatically.
Does anyone know how to achieve it through .NET or c#?
Thanks
I have the following code but the error is The error returned was: ERROR_BIND_TO_REMOTE_SERVER_FAILED
welcome all suggestioons.
using IADsTools;
string RemoteServer="capia1.capd.com:389";
string NamingContext="O=KKK,C=SG";
string SourceReplica="capia1.capd.com:389";
int UseFlags=0;
short UseCreds=1;
string UserName="user";
string DomainName="capd";
string UserDN="CN=user,CN=Users,DC=CAPD,DC=com";
string PassWord="password";
int error=0;
IADsTools._DCFunctions DLL=new IADsTools.DCFunctionsClass();
DLL.SetUserCredentials(ref UserName,ref DomainName,ref UserDN,ref PassWord);
error=DLL.ReplicaSync(ref RemoteServer,ref NamingContext,ref SourceReplica,ref UseFlags,ref UseCreds);
if(error==-1){
Console.WriteLine("The error returned was: {0}",DLL.LastErrorText);
}
else
{
Console.WriteLine("The command completed successfully");
}
-
April 7th, 2005, 06:50 PM
#2
Re: force ADAM replication
I have never worked with ReplicaSync - so I did some looking......
From MSDN:
user_name is the down-level user name of an account in the domain.
domain_name is the NetBIOS domain name of the user account.
user_LDAP_dn is not required for the ReplicaSync function but can be specified. This is the Distinguished Name of the user account specified.
password is the password for the user.
I would try to replace the UserDN variable with "" in the SetUserCredentials call - to force it to use the username domain combination - this eliminates the possibility of the DN being incorrect.
Also, I am not sure how the actual ReplicaSync call will work since you are trying to sync the directory server with itself.
-
April 7th, 2005, 07:52 PM
#3
Re: force ADAM replication
Actually there is no problem with the SetUserCredentials function.The problem lies with the ReplicaSync function. I change the SourceReplica value to "capia2.capd.com:389" and it still gives me the same error. As i am dealing with the Application Mode of AD, the server name together with the port number will give the actual location of the instance, i am not sure the iadstools functions are suitable for use.
-
April 8th, 2005, 05:22 AM
#4
Re: force ADAM replication
I would not expect you to receive an error on the SetUserCredentials call - since it is probably doing nothing more than loading a storage structure of some type that is used in the ReplicaSync call.
The error - ERROR_BIND_TO_REMOTE_SERVER_FAILED - would only show up in the ReplicaSync call because that is where the binds to the servers happen.
I think you would get a different error if you were able to bind but the sync would not work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|