Platform SDK: Network Management |
The NetGetAnyDCName function returns the name of any domain controller (DC) for a domain that is directly trusted by the specified server.
Windows 2000: Win32-based applications that support DNS-style names should call the DsGetDcName function. DsGetDcName can locate any DC in any domain, whether or not the domain is directly trusted by the specified server.
No special group membership is required to successfully execute the NetGetAnyDCName function.
NET_API_STATUS NetGetAnyDCName( LPCWSTR servername, LPCWSTR domainname, LPBYTE *bufptr );
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value can be one of the following error codes.
Value | Meaning |
---|---|
ERROR_NO_LOGON_SERVERS | No domain controllers could be found. |
ERROR_NO_SUCH_DOMAIN | The specified domain is not a trusted domain. |
ERROR_NO_TRUST_LSA_SECRET | The client side of the trust relationship is broken. |
ERROR_NO_TRUST_SAM_ACCOUNT | The server side of the trust relationship is broken or the password is broken. |
ERROR_DOMAIN_TRUST_INCONSISTENT | The server that responded is not a proper domain controller of the specified domain. |
If servername specifies a stand-alone Windows NT/Windows 2000 workstation or a stand-alone server, no domainname is valid.
If servername specifies a Windows NT/Windows 2000 workstation that is a member of a domain, or a Windows NT/Windows 2000 server that is a member of a domain, the domainname must be in the same domain as servername.
If servername specifies a domain controller, the domainname must be one of the domains trusted by the domain for which the server is a controller. The domain controller that this call finds has been operational at least once during this call.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Unsupported.
Header: Declared in Lmaccess.h; include Lm.h.
Library: Use Netapi32.lib.
Network Management Overview, Network Management Functions, Get Functions, DsGetDcName, NetGetDCName