Directory Services |
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 );
If the function returns account information, the return value is NO_ERROR.
If the function fails, the return value can be one of the following error codes.
Return Code | Description |
---|---|
ERROR_NO_SITENAME | The computer is not in a site. |
ERROR_NOT_ENOUGH_MEMORY | Insufficient memory is available. |
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.
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Unicode: Implemented as Unicode and ANSI versions.
Header: Declared in Dsgetdc.h.
Library: Use Netapi32.lib.
Directory Service Functions, DsGetDcName, DSValidateSubnetName, NetApiBufferFree