|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| No
| Win32s
| No
| Import Library
| netapi32.lib
| Header File
| lmaccess.h
| Unicode
| WinNT
| Platform Notes
| All LanMan APIs are UNICODE only
|
|
|
NetUserAdd
The
NetUserAdd function adds a user account and assigns a password and privilege level.
Security Requirements
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
|
|
);
|
|
Parameters
servername
Pointer to a Unicode string containing the name of the remote server on which
the function is to execute. A NULL pointer or string specifies the local
computer.
level
Specifies one of the following values to set the level of information provided.
Value
| Meaning
|
-
| The buf parameter points to a USER_INFO_1 structure.
|
-
| The buf parameter points to a USER_INFO_2 structure.
|
-
| The buf parameter points to a USER_INFO_3 structure.
|
buf
Pointer to the buffer in which the data set with the
level parameter is stored.
parm_err
Optional pointer to a
DWORD that contains the index of the first parameter that causes
ERROR_INVALID_PARAMETER. If NULL, the parameter is not returned on error.
Return Values
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.
|
Remarks
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
|
See Also
NetUserEnum,
NetUserSetInfo,
NetUserDel
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database