Platform SDK: Network Management |
The NetServerComputerNameAdd function enumerates the transports on which the specified server is active, and binds the emulated server name to each of the transports.
NetServerComputerNameAdd is a utility function that combines the functionality of the NetServerTransportEnum function and the NetServerTransportAddEx function.
Only members of the Administrators or Account Operators local group can successfully execute the NetServerComputerNameAdd function.
NET_API_STATUS NetServerComputerNameAdd( LPWSTR ServerName, LPWSTR EmulatedDomainName, LPWSTR EmulatedServerName );
If the function succeeds, the return value is NERR_Success. Note that NetServerComputerNameAdd succeeds if the emulated server name specified is added to at least one transport.
If the function fails, the return value can be one of the following error codes.
Value | Meaning |
---|---|
ERROR_ACCESS_DENIED | The user does not have access to the requested information. |
ERROR_DUP_NAME | A duplicate name exists on the network. |
ERROR_INVALID_DOMAINNAME | The domain name could not be found on the network. |
ERROR_INVALID_PARAMETER | The specified parameter is invalid. |
ERROR_NOT_ENOUGH_MEMORY | Insufficient memory is available. |
The server specified by the ServerName parameter continues to support all names it was supporting, and additionally begins to support new names supplied by successful calls to the NetServerComputerNameAdd function.
Name emulation that results from a call to NetServerComputerNameAdd ceases when the server reboots or restarts. To discontinue name emulation set by a previous call to NetServerComputerNameAdd without restarting or rebooting, you can call the NetServerComputerNameDel function.
The NetServerComputerNameAdd function is typically used when a system administrator replaces a server, but wants to keep the conversion transparent to users. Following is an example of a call to the NetServerComputerNameAdd function requesting that \\Server1 also respond to requests for \\Server2.
NetServerComputerNameAdd (Server1, NULL, Server2);
For more information about registry settings that result in persistent emulations, see the Windows 2000 resource kits.
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Unsupported.
Header: Declared in Lmserver.h; include Lm.h.
Library: Use Netapi32.lib.
Network Management Overview, Network Management Functions, Server Functions, NetServerTransportEnum, NetServerTransportAdd, NetServerTransportAddEx, NetServerComputerNameDel