大网数据广告活动
域与目录服务

Error when running the Adprep /rodcprep command in Windows Server 2008

· 52CE 我爱测

The Adprep /rodcprep command isn't completed successfully. The reason is that the infrastructure master for one or more active directory Non-Domain Naming Contexts (NDNCs) isn't reachable. A resolution is provided.

This article solves a problem that the Adprep /rodcprep command isn't completed successfully because the infrastructure master for one or more active directory NDNCs isn't reachable.

Original KB number:   949257

Symptoms

When you run the Adprep /rodcprep command on Windows Server 2008, you receive the following error message:

Adprep could not contact a replica for partition DC=DomainDnsZones,DC=Contoso,DC=com

Adprep failed the operation on partition DC=DomainDnsZones,DC=Contoso,DC=com Skipping to next partition.

Adprep could not contact a replica for partition DC=ForestDnsZones,DC=Contoso,DC=com

Adprep encountered an LDAP error. Error code: 0x0. Server extended error code: 0x0, Server error message: (null).

Adprep failed the operation on partition DC=ForestDnsZones,DC=Contoso,DC=com Skipping to next partition.

Adprep completed with errors. Not all partitions are updated.

Cause

This problem occurs when the Adprep /rodcprep command tries to contact the infrastructure master for each application partition in the forest. The command does it to set the permissions that are required for Read-Only Domain Controller (RODC) replication. The Adprep /rodcprep command fails if one of the following conditions is true:

  • The partition or the partitions that are referenced in the error message no longer exist.
  • The infrastructure master for the referenced partition or partitions has been forcefully demoted or is offline.

Resolution

To resolve this problem if the partition no longer exists, do a metadata cleanup for the orphaned partition using the "remove nc" parameter of the Dsmgmt tool. For more information, visit the following Microsoft Web site:

partition management

If the specified partition exists, specify an infrastructure role owner that is online for the partition. You can do it by manually modifying the fSMORoleOwner attribute on the object, as described in the "More information" section.

More information

The following script sample modifies the fSMORoleOwner attribute on the infrastructure object of the specified Non-Domain Naming Context (NDNC) to an active, or contactable, server. The NDNC in this sample is the DomainDnsZones,DC=contoso,DC=com NDNC naming context. The script uses the following command:

cscript fixfsmo.vbs DC=DomainDnsZones,DC=contoso,DC=com
'-------fixfsmo.vbs------------------
const ADS_NAME_INITTYPE_GC = 3
const ADS_NAME_TYPE_1779 = 1
const ADS_NAME_TYPE_CANONICAL = 2

set inArgs = WScript.Arguments

if (inArgs.Count = 1) then
    ' Assume the command line argument is the NDNC (in DN form) to use.
    NdncDN = inArgs(0)
Else
    Wscript.StdOut.Write "usage: cscript fixfsmo.vbs NdncDN"
End if

if (NdncDN <> "") then

    ' Convert the DN form of the NDNC into DNS dotted form.
    Set objTranslator = CreateObject("NameTranslate")
    objTranslator.Init ADS_NAME_INITTYPE_GC, ""
    objTranslator.Set ADS_NAME_TYPE_1779, NdncDN
    strDomainDNS = objTranslator.Get(ADS_NAME_TYPE_CANONICAL)
    strDomainDNS = Left(strDomainDNS, len(strDomainDNS)-1)

    Wscript.Echo "DNS name: " & strDomainDNS

    ' Find a domain controller that hosts this NDNC and that is online.
    set objRootDSE = GetObject("LDAP://" & strDomainDNS & "/RootDSE")
    strDnsHostName = objRootDSE.Get("dnsHostName")
    strDsServiceName = objRootDSE.Get("dsServiceName")
    Wscript.Echo "Using DC " & strDnsHostName

    ' Get the current infrastructure fsmo.
    strInfraDN = "CN=Infrastructure," & NdncDN
    set objInfra = GetObject("LDAP://" & strInfraDN)
    Wscript.Echo "infra fsmo is " & objInfra.fsmoroleowner

    ' If the current fsmo holder is deleted, set the fsmo holder to this domain controller.

    if (InStr(objInfra.fsmoroleowner, "\0ADEL:") > 0) then

        ' Set the fsmo holder to this domain controller.
        objInfra.Put "fSMORoleOwner",  strDsServiceName
        objInfra.SetInfo

        ' Read the fsmo holder back.
        set objInfra = GetObject("LDAP://" & strInfraDN)
        Wscript.Echo "infra fsmo changed to:" & objInfra.fsmoroleowner

    End if

End if

To determine the infrastructure master for a partition, query the fSMORoleOwner attribute on the infrastructure object under the naming context root in question. For example, query the fSMORoleOwner attribute on the CN=Infrastructure,DC=DomainDnsZones,DC=contoso,DC=com naming context root to determine the infrastructure master for the DC=DomainDnsZones,DC=contoso,DC=com partition. Similarly, query the fSMORoleOwner attribute on the CN=Infrastructure,DC=ForestDnsZones,DC=contoso,DC=com naming context root to determine the infrastructure master for the DC=ForestDnsZones,DC=contoso,DC=com partition.

You can use tools such as the LDP tool, the Active Directory Service Interfaces (ADSI) Edit tool, and the ldifde tool to do these queries. For example, the following query uses the Idifde tool:

ldifde -f Infra_DomainDNSZones.ldf -d "CN=Infrastructure,DC=DomainDnsZones,DC=contoso,DC=com" -l fSMORoleOwner

This query returns the infrastructure master role owner for the DC=DomainDnsZones,DC=contoso,DC=com partition to the Infra_DomainDNSZones.ldf file.

Note: You can run the Adprep /rodcprep command multiple times without harming the forest. Operations that were completed in earlier executions of the rodcprep command aren't repeated.

If you try to run the rodcprep command in an isolated environment, the infrastructure master for each domain and for each application directory partition must be available within the environment for the operation to succeed.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
- Supported versions of Windows Server · Source date 02/12/2026
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。