The NetUserAdd function adds a user account and assigns a password and privilege level.
Only members of the Administrators or Account Operators local group can successfully execute NetUserAdd. Only members of the Administrators local group can add an Administrators privilege account.
NET_API_STATUS NetUserAdd(
LPWSTR servername, | |
DWORD level, | |
LPBYTE buf, | |
LPDWORD parm_err | |
); |
Value |
Meaning |
1 |
The buf parameter points to a USER_INFO_1 structure. |
2 |
The buf parameter points to a USER_INFO_2 structure. |
3 |
The buf parameter points to a USER_INFO_3 structure. |
If the function returns account information, the return value is NERR_Success.
If the function fails, the return value is one of the following error codes.
Value |
Meaning |
ERROR_ACCESS_DENIED |
The user does not have access to the requested information. |
NERR_InvalidComputer |
Thiecomputer name is invalid. |
NERR_NotPrimary |
The operation is allowed only on the primary domain controller of the domain. |
NERR_GroupExists |
The group already exists. |
NERR_UserExists |
The user account already exists. |
NERR_PasswordTooShort |
The password is shorter than required. |
Server users must use a system in which the server creates a WINDOWS NT system account for the new user. The creation of this account is controlled by several parameters in the server’s LANMAN.INI file.
If the newly added server user name already exists as a Windows NT system user, the useril_home_dir member of the USER_INFO_1 structure is ignored. The NetUserAdd function supports USER_INFO_1 and USER_INFO_2 structures. Using members of USER_INFO_1 initializes default values in USER_INFO_2 and USER_INFO_3 structures.
Subsequent NetUserSetInfo calls can change the default values. The following are possible default values.
Member |
Default Value |
usriX_auth_flags |
None (0) |
usriX_full_name |
usri1_name |
usriX_usr_comment |
None (null string) |
usriX_parms |
None (null string) |
usriX_workstations |
All (null string) |
usriX_acct_expires |
Never (TIMEQ_FOREVER) |
usriX_max_storage |
Unlimited (USER_MAXSTORAGE_UNLIMITED) |
usriX_logon_hours |
Logon allowed at any time (each element 0xFF; all bits set to 1) |
usriX_logon_server |
Any domain controller (\\*) |
usriX_country_code |
Current (country_code on the server |
usriX_code_page |
0 |
NetUserEnum, NetUserSetInfo, NetUserDel
file: /Techref/os/win/api/win32/func/src/f63_17.htm, 8KB, , updated: 2000/4/7 11:19, local time: 2024/11/28 13:07,
18.117.105.215:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/techref/os/win/api/win32/func/src/f63_17.htm"> NetUserAdd</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.