DsRemoveDsServer function
The DsRemoveDsServer function removes all traces of a directory service agent (DSA) from the global area of the directory service.
Syntax
DWORD DsRemoveDsServer( _In_ HANDLE hDs, _In_ LPTSTR ServerDN, _In_opt_ LPTSTR DomainDN, _Out_opt_ BOOL *fLastDcInDomain, _In_ BOOL fCommit );
Parameters
- hDs [in]
-
Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.
- ServerDN [in]
-
Pointer to a null-terminated string that specifies the fully qualified distinguished name of the domain controller to remove.
- DomainDN [in, optional]
-
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 [out, optional]
-
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 [in]
-
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.
- ERROR_ACCESS_DENIED
-
The caller does not have permissions to delete ServerDN.
- ERROR_DS_BAD_NAME_SYNTAX
-
Returned when fCommit is nonzero and the syntax of ServerDN is invalid.
- ERROR_DS_CANT_DELETE_DSA_OBJ
-
The bind handle supplied in hDs is currently bound to ServerDN.
- ERROR_DS_NO_CROSSREF_FOR_NC
-
Cannot find a cross reference object for DomainDN.
- ERROR_INVALID_PARAMETER
-
One or more parameters are invalid.
- RPC_S_CANNOT_SUPPORT
-
The DsRemoveDsServer function is not supported.
- RPC_S_INVALID_VERS_OPTION
-
A versioning error occurred.
Requirements
|
Minimum supported client |
Windows Vista |
|---|---|
|
Minimum supported server |
Windows Server 2008 |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
DsRemoveDsServerW (Unicode) and DsRemoveDsServerA (ANSI) |
See also