Platform SDK: RAS/Routing and RAS

RasAdminGetUserAccountServer

The RasAdminGetUserAccountServer function retrieves the name of the server that has the user account database. You can use the returned server name in the RasAdminUserGetInfo and RasAdminUserSetInfo functions to get or set information about a specified user.

DWORD RasAdminGetUserAccountServer(
  const WCHAR *lpszDomain,      // pointer to the name of
                                //  the Windows NT/2000 domain
  const WCHAR *lpszServer,      // pointer to the name of
                                //  the RAS server
  LPWSTR lpszUserAccountServer  // receives the name of
                                //  the user account server
);

Parameters

lpszDomain
Pointer to a null-terminated Unicode string that contains the name of the domain to which the RAS server belongs. This parameter can be NULL if you are running your RAS administration application on a Windows NT/2000 workstation or server that is not participating in a Windows NT/2000 domain. If this parameter is NULL, the lpszServer parameter must be non-NULL.
lpszServer
Pointer to a null-terminated Unicode string that contains the name of the Windows NT/Windows 2000 RAS server. Specify the name with leading "\\" characters, in the form: \\servername. This parameter can be NULL if the lpszDomain parameter is not NULL.
lpszUserAccountServer
Pointer to a buffer that receives a null-terminated Unicode string containing the name of a domain controller that has the user account database. The buffer should be big enough to hold the server name (UNCLEN +1). The function prefixes the returned server name with leading "\\" characters, in the form: \\servername.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value can be the following error code.

Value Meaning
ERROR_INVALID_PARAMETER Both lpszDomain and lpszServer are NULL.

There is no extended error information for this function; do not call GetLastError.

Remarks

The RasAdminGetUserAccountServer function can obtain the name of the server with the user accounts database given the name of the RAS server, or the name of the domain in which the RAS server resides.

The lpszDomain parameter should specify a valid Windows NT/Windows 2000 domain name. If you are running your RAS administration application on a Windows NT/Windows 2000 server that is not participating in a Windows NT/Windows 2000 domain (for example, the server is in its own workgroup), then set lpszDomain to NULL. In this case, the lpszServer parameter must specify the server name. To get the server name, call the GetComputerName function. Be sure to prefix the server name with the "\\" characters.

If the server name specified by lpszServer is a stand-alone Windows NT/Windows 2000 server (that is, the server or workstation does not participate in a Windows NT/Windows 2000 domain), then the server name itself is returned in the lpszUserAccountServer buffer.

You can then use the name of the user account server in a call to the NetQueryDisplayInformation function to enumerate the users in the user account database.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Header: Declared in Rassapi.h.
  Library: Use Rassapi.lib.

See Also

Remote Access Service (RAS) Overview, RAS Server Administration Functions, GetComputerName, RasAdminUserGetInfo, RasAdminUserSetInfo