DsReplicaSyncAll function

The DsReplicaSyncAll function synchronizes a server with all other servers, using transitive replication, as necessary. By default, DsReplicaSyncAll synchronizes the server with all other servers in its site; however, you can also use it to synchronize across site boundaries.


DWORD DsReplicaSyncAll(
  _In_      HANDLE                 hDS,
  _In_      LPTSTR                 pszNameContext,
  _In_      ULONG                  ulFlags,
  _In_      BOOL (__stdcall *pFnCallBack)(LPVOID, PDS_REPSYNCALL_UPDATEW),
  _In_opt_  LPVOID                 pCallbackData,
  _Out_opt_ PDS_REPSYNCALL_ERRINFO **pErrors


hDS [in]

Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.

pszNameContext [in]

Pointer to a null-terminated string that specifies the distinguished name of the naming context to synchronize. The pszNameContext parameter is optional; if its value is NULL, the configuration naming context is replicated.

ulFlags [in]

Passes additional data used to process the request. This parameter can be a combination of the following values.


Generates a fatal error if any server cannot be contacted or if any server is unreachable due to a disconnected or broken topology.


Synchronizes across site boundaries. By default, DsReplicaSyncAll attempts to synchronize only with DCs in the same site as the home system. Set this flag to attempt to synchronize with all DCs in the enterprise forest. However, the DCs can be synchronized only if connected by a synchronous (RPC) transport.


Disables all synchronization. The topology is still analyzed, and unavailable or unreachable servers are still identified.


In the event of a non-fatal error, returns server distinguished names (DN) instead of their GUID DNS names.


This option has no effect.


Pushes changes from the home server out to all partners using transitive replication. This reverses the direction of replication, and the order of execution of the replication sets from the usual "pulling" mode of execution.


Assumes that all servers are responding. This speeds operation of the DsReplicaSyncAll function, but if some servers are not responding, some transitive replications may be blocked.


Disables transitive replication. Synchronization is performed only with adjacent servers.

pFnCallBack [in]

Pointer to an application-defined SyncUpdateProc function called by the DsReplicaSyncAll function when it encounters an error, initiates synchronization of two servers, completes synchronization of two servers, or finishes synchronization of all the servers in the site.

pCallbackData [in, optional]

Pointer to application-defined data passed as the first argument of the SyncUpdateProc callback function pointed to by the pFnCallBack parameter.

pErrors [out, optional]

A NULL-terminated array of pointers to DS_REPSYNCALL_ERRINFO structures that contain errors that occurred during synchronization. The memory used to hold both the array of pointers and the MsCS\mscs\clusctl_resource_type_get_private_property_fmts.xml data is allocated as a single block of memory and should be freed when no longer required by a single call to LocalFree with the pointer value returned in pErrors used as the argument.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is as follows.


The return value from the callback function, pointed to by pFnCallBack, was FALSE, causing replication to be terminated.


The DsReplicaSyncAll function attempts to bind to all servers before generating a topology to synchronize from. If a server cannot be contacted, the function excludes that server from the topology and attempts to work around it. Setting the DS_REPSYNCALL_SKIP_INITIAL_CHECK flag in ulFlags bypasses the initial binding.

If a server cannot be contacted, the DsReplicaSyncAll function attempts to route around it and replicate from as many servers as possible, unless DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE is set in ulFlags.

The DsReplicaSyncAll function can use the callback function pointed to by pFnCallBack to keep an end user informed about the current status of the replication. Execution of the DsReplicaSyncAll function pauses when it calls the function pointed to by pFnCallBack. If the return value from the callback function is TRUE, replication continues; otherwise, the DsReplicaSyncAll function terminates replication.


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008







Unicode and ANSI names

DsReplicaSyncAllW (Unicode) and DsReplicaSyncAllA (ANSI)

See also

Domain Controller and Replication Management Functions