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.
The NetGetDCName function is obsolete. It is provided only for compatibility with 16-bit versions of Windows. For NT5 and subsequent versions, Win32-based applications should use the DSGetDCName function.
No special group membership is required to successfully execute NetGetDCName.
NET_API_STATUS NetGetDCName(
LPWSTR servername,
LPWSTR domainname,
LPBYTE *bufptr
);
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value is 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: Requires version 3.1 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in lmaccess.h.
Import Library: Use netapi32.lib.
Networking (Net) Overview, Net Functions, NetGetAnyDCName