Directory Services


The DsDeregisterDnsHostRecords function deletes DNS entries, except for type A records registered by a domain controller. Only an administrator, account operator, or server operator may call this function.

DWORD DsDeregisterDnsHostRecords(
  LPTSTR ServerName,
  LPTSTR DnsDomainName,
  GUID* DomainGuid,
  GUID* DsaGuid,
  LPTSTR DnsHostName


[in, optional] The null-terminated string that specifies the name of the remote domain controller. Can be set to NULL if the calling application is running on the domain controller being updated.
[in, optional] The null-terminated string that specifies the DNS domain name of the domain occupied by the domain controller. It is unnecessary for this to be a domain hosted by this domain controller. If NULL, the DnsHostName with the leftmost label removed is specified.
[in, optional] Pointer to the Domain GUID of the domain. If NULL, GUID specific names are not removed.
[in, optional] Pointer to the GUID of the NTDS-DSA object to be deleted. If NULL, NTDS-DSA specific names are not removed.
[in] Pointer to the null-terminated string that specifies the DNS host name of the domain controller whose DNS records are being deleted.

Return Values

Return Code Description
NO_ERROR Success
ERROR_ACCESS_DENIED The user is not authorized to perform this operation.
ERROR_NOT_SUPPORTED The specified server is not a DC.


This function deregisters SRV and CNAME records only. It leaves type A records intact. Deletion of site specific records, for example, _ldap._tcp._<SiteName>._sites.dc._msdcs.<DnsDomainName>, is attempted for every site (<SiteName> in this example) in the enterprise of the domain controller on which the function is executed. Therefore, this function call could create a time-consuming run and may generate significant network traffic for enterprises with many sites.


Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Unicode: Implemented as Unicode and ANSI versions.
Header: Declared in Dsgetdc.h.
Library: Use Netapi32.lib.

See Also

DsGetDcSiteCoverage, DsGetSiteName