Reputation: 7892
Does anyone know how to Force Replicate a Single Active Directory Object Programatically?
To be clearer I want to replicate this
CN=Sample User,OU=Sample OU,DC=company,DC=com
and the whole partition like this
DC=company,DC=com
I tried DomainController.SyncReplicaFromAllServers Method
but I guess its used for partitions.
Upvotes: 3
Views: 3486
Reputation: 11
I write this Code for i can make Rep between Two DC but its work only with Admin Permisson from IIS Pool in VS2015 rus as admin in IIS you must change Application Pool Identity :
public static SecureString sSPasswordFianl;
public static void Securepass()
{
string sPassword = "yourpassword";
SecureString sSPassword = new SecureString();
foreach (char X in sPassword)
sSPassword.AppendChar(X);
sSPasswordFianl = sSPassword;
}
public static string RepTXADp01()
{
try
{
Process Replactions = new Process();
ProcessStartInfo procInfo = new ProcessStartInfo();
procInfo.UseShellExecute = false;
procInfo.FileName = HttpContext.Current.Server.MapPath("~/Rep.bat");
procInfo.WorkingDirectory = @""; //The working DIR.
Securepass();
procInfo.Verb = "runasuser";
procInfo.Domain = "yourDomian.de";
procInfo.UserName = "Username";
procInfo.Password = sSPasswordFianl;
procInfo.CreateNoWindow = true;
Process.Start(procInfo); //Start that process.
string output;
return (output="OK");
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
Reb.bat:
repadmin /replicate server1 Server2 DC=yourdomian ,DC=com
Upvotes: 1
Reputation: 21
You can replicate a single object by using "repadmin /replsingleobj" (http://technet.microsoft.com/en-us/library/cc742123.aspx)
Upvotes: 2
Reputation: 395
Theres no way to do this on an object level, the best workaround is when you save your object try to save it on all domain contollers (if needed)
i.e. you have Domain Controller 1, Domain Controller 2, Domain Controller 3 do save in all rather than wait for it to replicate across.
Upvotes: 0
Reputation: 3106
The direct answer is no, you can not say to the ldap server to replicate only one object. The replication always works for partition/naming context.
Active Directory has a Global Catalog, that can be used. There are bunch of attribute marked as PAS attribute (Partial Attribute Set). From every Domain Controller the PAS attribute from every object will be synced immediately to all GC server by KCC. You can read more about this in microsft document You can do the ldap searches on the GC port (3268) to find the object attributes quickly.
But if you can tell more specific details of your need that will help.
Upvotes: 2