Group: Network Management - Library: netapi32
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.
Retrieving the name of the primary domain controller (PDC) and join status information
NET_API_STATUS NetGetDCName(
LPCWSTR servername,
LPCWSTR domainname,
LPBYTE *bufptr
);
DECLARE INTEGER NetGetDCName IN netapi32;
STRING servername,;
STRING domainname,;
INTEGER @ bufptr
servername [in] Pointer to a constant Unicode string specifying the name of the remote server on which the function is to execute.
domainname [in] Pointer to a constant Unicode string specifying the name of the domain.
bufptr [out] Pointer to an allocated buffer that receives a Unicode string which specifies the server name of the PDC of the domain.
If the function succeeds, the return value is NERR_Success (0).
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Unsupported.
This buffer is allocated by the system and must be freed using the NetApiBufferFree function.