Platform SDK: Network Management |
The NetGetDCName function returns the name of the primary domain controller (PDC). It does not return the name of the backup domain controller (BDC) for the specified domain. Also, you cannot remote this function to a non-PDC server.
Windows 2000: Win32-based applications that support DNS-style names should call the DsGetDcName function. Domain controllers in a Windows 2000 environment have a multi-master directory replication relationship. Therefore, it may be advantageous for your application to use a DC that is not the PDC. You can call the DsGetDcName function to locate any DC in the domain; NetGetDCName returns only the name of the PDC.
No special group membership is required to successfully execute the NetGetDCName function.
NET_API_STATUS NetGetDCName( 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 |
---|---|
NERR_DCNotFound | Could not find the domain controller for the domain. |
ERROR_INVALID_NAME | The name could not be found. |
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, NetGetAnyDCName