DsListServersForDomainInSiteA function (ntdsapi.h)

The DsListServersForDomainInSite function lists all the servers in a domain in a site.


NTDSAPI DWORD DsListServersForDomainInSiteA(
  [in]  HANDLE           hDs,
  [in]  LPCSTR           domain,
  [in]  LPCSTR           site,
  [out] PDS_NAME_RESULTA *ppServers


[in] hDs

Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.

[in] domain

Pointer to a null-terminated string that specifies the domain name. This string must be the same as one of the strings returned by DsListDomainsInSite function.

[in] site

Pointer to a null-terminated string that specifies the site name. This string is taken from the list of site names returned by the DsListSites function.

[out] ppServers

Pointer to a pointer to a DS_NAME_RESULT structure that receives the list of servers in the domain. The returned structure must be freed using the DsFreeNameResult function.

Return value

If the function returns a list of servers, the return value is NO_ERROR. If the function fails, the return value can be one of the following error codes.


Individual name conversion errors are reported in the returned DS_NAME_RESULT structure.


The ntdsapi.h header defines DsListServersForDomainInSite as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header ntdsapi.h
Library Ntdsapi.lib
DLL Ntdsapi.dll

See also


Domain Controller and Replication Management Functions