Directory Services

DsReplicaSyncAll

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(
  HANDLE hDS,
  LPTSTR pszNameContext,
  ULONG ulFlags,
  BOOL (__stdcall * pFnCallBack) (LPVOID, PDS_REPSYNCALL_UPDATEW),
  LPVOID pCallbackData,
  PDS_REPSYNCALL_ERRINFO** pErrors
);

Parameters

hDS
[in] Bind handle to the directory service.
pszNameContext
[in] Pointer to a null-terminated string that specifies the distinguished name (DN) 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.
Value Meaning
DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE Generates a fatal error if any server cannot be contacted or if any server is unreachable due to a disconnected or broken topology.
DS_REPSYNCALL_CROSS_SITE_BOUNDARIES 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.
DS_REPSYNCALL_DO_NOT_SYNC Disables all synchronization. The topology is still analyzed, and unavailable or unreachable servers are still identified.
DS_REPSYNCALL_ID_SERVERS_BY_DN In the event of a non-fatal error, returns server distinguished names (DN) instead of their GUID DNS names.
DS_REPSYNCALL_NO_OPTIONS This option has no effect.
DS_REPSYNCALL_PUSH_CHANGES_OUTWARD 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.
DS_REPSYNCALL_SKIP_INITIAL_CHECK 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.
DS_REPSYNCALL_SYNC_ADJACENT_SERVERS_ONLY 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 sychronization 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] Pointer to a variable that receives a pointer to an array of DS_REPSYNCALL_ERRINFO structures that contain errors which occurred during synchronization. The memory used to hold both the array pointers and the ERRINFO data is allocated as a single block of memory and should be freed when no longer needed by a single call to LocalFree with the pointer value returned in pErrors used as the argument.

Return Values

If the function performs its operation successfully, the return value is ERROR_SUCCESS.

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

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

Remarks

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 route 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.

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Ntdsapi.h.
Library: Use Ntdsapi.lib.

See Also

DsReplicaSync, DS_REPSYNCALL_ERRINFO, DS_REPSYNCALL_UPDATE, SyncUpdateProc, Domain Controller and Replication Management Functions