DsRemoveDsServerW function (ntdsapi.h)

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

Syntax

NTDSAPI DWORD DsRemoveDsServerW(
  HANDLE hDs,
  LPWSTR ServerDN,
  LPWSTR DomainDN,
  BOOL   *fLastDcInDomain,
  BOOL   fCommit
);

Parameters

hDs

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

ServerDN

Pointer to a null-terminated string that specifies the fully qualified distinguished name of the domain controller to remove.

DomainDN

Pointer to a null-terminated string that specifies a domain hosted by ServerDN. If this parameter is NULL, no verification is performed to ensure that ServerDN is the last domain controller in DomainDN.

fLastDcInDomain

Pointer to a Boolean value that receives TRUE if ServerDN is the last DC in DomainDN or FALSE otherwise. This parameter receives FALSE if DomainDN is NULL.

fCommit

Contains a Boolean value that specifies if the domain controller should actually be removed. If this parameter is nonzero, ServerDN is removed. If this parameter is zero, the existence of ServerDN is checked and fLastDcInDomain is written, but the domain controller is not removed.

Return value

Returns ERROR_SUCCESS if successful or a Win32 or RPC error code if unsuccessful. Possible error codes include the following.

Remarks

Note

The ntdsapi.h header defines DsRemoveDsServer as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

   
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header ntdsapi.h
Library Ntdsapi.lib
DLL Ntdsapi.dll

See also

Domain Controller and Replication Management Functions

DsBind

DsBindWithCred

DsRemoveDsDomain