Directory Services

DsRemoveDsDomain

The DsRemoveDsDomain function removes all traces of a domain naming context from the global area of the directory service.

DWORD DsRemoveDsDomain(
  HANDLE hDs,
  LPTSTR DomainDN
);

Parameters

hDs
[in] Bind handle to the directory service. This handle is returned by a call to the DsBind or DsBindWithCred functions.
DomainDN
[in] Pointer to a null-terminated string that specifies the distinguished name of the naming context to remove from the directory service.

Return Values

Returns ERROR_SUCCESS if successful or a Win32 or RPC error code if unsuccessful. Possible error codes include the following.
Return Code Description
ERROR_DS_CANT_DELETE The domain object cannot be deleted because there are still domain controllers that host that domain.
ERROR_DS_ILLEGAL_MOD_OPERATION The domain object being deleted is bound to by hDs.
ERROR_DS_NC_STILL_HAS_DSAS The domain object cannot be deleted because there are still domain controllers that host that domain.
ERROR_DS_NO_CROSSREF_FOR_NC A cross reference for the naming context cannot be found.
ERROR_INVALID_PARAMETER A parameter is incorrect.
RPC_S_CANNOT_SUPPORT The DsRemoveDsDomain function is not supported.
RPC_S_INVALID_VERS_OPTION A versioning error occurred.

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.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.
Header: Declared in Ntdsapi.h.
Library: Use Ntdsapi.lib.

See Also

DsBind, DsBindWithCred, DsRemoveDsServer, Domain Controller and Replication Management Functions