Error message when you run the "Adprep /rodcprep" command in Windows Server 2008: "Adprep could not contact a replica for partition

March 8, 2011


I was recently prepping a Windows Active Directory for Windows 2008 R2.  I was able to prep the forest and domain with no issues, we decided to prep AD for Read Only Domain Controllers in case we decided to roll one out and encountered the error, “Adprep could not contact a replica for partition”

After some searching, I found this Microsoft KB Article:


Microsoft explains,

When the Adprep /rodcprep command tries to contact the infrastructure master for each application partition in the forest. The command does this 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.

The fix is running these commands from the Windows 2003 DC that holds the Infrastructure Master Role:

cscript fixfsmo.vbs DC=DomainDnsZones,DC=domainname,DC=com

cscript fixfsmo.vbs DC=DomainDnsZones,DC=domainname,DC=com

You can create the fixfsmo.vbs script file from this text:

const ADS_NAME_TYPE_1779 = 1

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)
    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, "ADEL:") > 0) then

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

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

    End if

End if


One comment

  1. Thanks for the write up!

    I did find an error when I attempted to run the script. For whatever reason it didn’t like lines 5 and 8.

    Found another copy of the script at M$ KB949257.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: