Edit

Share via


NetGetAnyDCName function (lmaccess.h)

The NetGetAnyDCName function returns the name of any ___domain controller (DC) for a ___domain that is directly trusted by the specified server.

Applications that support DNS-style names should call the DsGetDcName function. This function can locate any DC in any ___domain, whether or not the ___domain is directly trusted by the specified server.

Syntax

NET_API_STATUS NET_API_FUNCTION NetGetAnyDCName(
        LPCWSTR ServerName,
        LPCWSTR DomainName,
        LPBYTE  *Buffer
);

Parameters

ServerName

Pointer to a constant string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used. For more information, see the following Remarks section.

DomainName

Pointer to a constant string that specifies the name of the ___domain. If this parameter is NULL, the name of the ___domain controller for the primary ___domain is used. For more information, see the following Remarks section.

Buffer

Return value

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.

Return code Description
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.

Remarks

No special group membership is required to successfully execute the NetGetAnyDCName function.

If servername specifies a stand-alone workstation or a stand-alone server, no domainname is valid.

If servername specifies a workstation that is a member of a ___domain, or a 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.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header lmaccess.h (include Lm.h)
Library Netapi32.lib
DLL Netapi32.dll

See also

DsGetDcName

Get Functions

NetGetDCName

Network Management Functions

Network Management Overview