Platform SDK: Active Directory, ADSI, and Directory Services

DsRemoveDsServer

The DsRemoveDsServer function removes all traces of a directory service agent (DSA) from the global area of the directory service.

DWORD DsRemoveDsServer(
  HANDLE hDs,
  LPTSTR ServerDN,
  LPTSTR DomainDN,
  BOOL *fLastDcInDomain,
  BOOL fCommit
);

Parameters

hDs
[in] Bind handle to the directory service.
ServerDN
[in] Pointer to a null-terminated Unicode string specifying the distinguished name (DN) of the server object to be removed.
DomainDN
[in, optional] Pointer to a null-terminated Unicode string specifying a domain hosted by ServerDN. If this parameter is NULL, no check will be made to see if ServerDN is the last domain controller (DC) in DomainDN.
fLastDcInDomain
[out, optional] Pointer to a Boolean value that is set to true if ServerDN is the last DC in DomainDN. This parameter is not set if DomainDN is NULL.
fCommit
[in] Boolean value indicating whether the caller really wants to remove the server. If true, DsRemoveDsServer will remove ServerDN; if false, the existence of ServerDN will be checked and fLastDcInDomain will be written, but the server will not be removed.

Return Values

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

If the function fails, the return value can be one of the following.

DS_ERR_CANT_DELETE_DSA_OBJ
The bind handle supplied in hDs is currently bound to ServerDN.
DS_ERR_NO_CROSSREF_FOR_NC
Cannot find a cross reference object for DomainDN.
ERROR_ACCESS_DENIED
The caller does not have the correct permissions to delete ServerDN.
ERROR_INVALID_PARAMETER
A parameter is incorrect.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Ntdsapi.h.
  Library: Included as a resource in Ntdsapi.dll.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

DC and Replication Management Functions, DsRemoveDsDomain