有誰知道如何以編程方式強制複製單個Active Directory對象?強制以編程方式複製單個Active Directory對象
爲了更清楚我想複製這個
CN=Sample User,OU=Sample OU,DC=company,DC=com
和整個分區這樣
DC=company,DC=com
我試圖DomainController.SyncReplicaFromAllServers Method
,但我想它的使用分區。
有誰知道如何以編程方式強制複製單個Active Directory對象?強制以編程方式複製單個Active Directory對象
爲了更清楚我想複製這個
CN=Sample User,OU=Sample OU,DC=company,DC=com
和整個分區這樣
DC=company,DC=com
我試圖DomainController.SyncReplicaFromAllServers Method
,但我想它的使用分區。
世界上沒有辦法做到這一點對一個對象的水平,最好的解決方法是,當你保存你的對象嘗試將其保存在所有域contollers(如果需要)
即你有域控制器1,域控制器2 ,域控制器3完全保存,而不是等待它複製。
直接的答案是否定的,你不能說ldap服務器只複製一個對象。複製總是適用於分區/命名上下文。
Active Directory有一個全局編錄,可以使用。有一堆屬性標記爲PAS屬性(部分屬性集)。從每個域控制器,每個對象的PAS屬性將被KCC立即同步到所有GC服務器。您可以在microsft document中閱讀更多關於此的信息。您可以在GC端口(3268)上執行ldap搜索以快速查找對象屬性。
但是,如果你可以告訴你需要更多具體的細節,這將有助於。
您可以通過使用「REPADMIN/replsingleobj」複製單個對象(http://technet.microsoft.com/en-us/library/cc742123.aspx)
謝謝,是否有.net api可用於此命令? – sagar 2015-04-23 09:54:27
我寫這個代碼我可以在兩個DC 但其僅具有管理員在未經許可從IIS池 在VS2015的工作之間做出衆議員RUS爲管理 在IIS中必須更改應用程序池標識:
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
對於此場景來說,這將是一個很好的解決方法 – Raymund 2011-04-26 20:44:25
oops! !這會在ObjectGUID中引入衝突,並且這些條目永遠不會同步。對於每個對象,都會有一個objectGUID在創建期間生成。即使是DN改變GUID也不會改變。這意味着你所有的DC對於同一個條目都會有不同的GUID,當他們嘗試同步GUID時會發生衝突。大多數情況下,ldap服務器會從同步中刪除此特定條目。所以下一次當您更新「ldapmodify -h domain.com ...」時,只要該服務器將被更新。當你做ldapsearch時,你會得到意想不到的結果 – kalyan 2011-04-27 10:59:53
@kalyan - 你不覺得AD將足夠聰明,能夠根據上次更新的時間戳來解析複製嗎? – Raymund 2011-04-27 20:34:47