Platform SDK: RAS/Routing and RAS |
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 );
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.
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.
Windows NT/2000: Requires Windows NT 4.0 or later.
Header: Declared in Rassapi.h.
Library: Use Rassapi.lib.
Remote Access Service (RAS) Overview, RAS Server Administration Functions, GetComputerName, RasAdminUserGetInfo, RasAdminUserSetInfo