DsGetSiteName

[This is preliminary documentation and subject to change.]

The DsGetSiteName function returns the name of the site where a computer resides. For a domain controller (DC), the name of the site is the location of the configured DC. For a member workstation or member server, the name specifies the workstation site as configured in the domain of the computer.

DWORD DsGetSiteName(
  LPCTSTR ComputerName,
  LPTSTR *SiteName
);
 

Parameters

ComputerName
Pointer to a null-terminated string that specifies the name of the server to send this function. A NULL implies the local computer.
SiteName
Pointer to a variable that receives a pointer to a null-terminated string containing the site location of this computer. The returned buffer must be deallocated using NetApiBufferFree.

Remarks

The DsGetSiteName function does not require any particular access to the specified domain. The function is sent to the Netlogon service on the computer specified by ComputerName.

Return Values

If the function returns account information, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Value Meaning
ERROR_NO_SITENAME The computer is not in a site.
ERROR_NOT_ENOUGH_MEMORY Insufficient memory is available.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in dsgetdc.h.
  Import Library: Use netapi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Networking (Net) Overview, Net Functions, DsGetDcName, DSValidateSubnetName