please dont rip this site Prev Next

NetUserAdd info  Overview  Group

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

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.

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


file: /Techref/os/win/api/win32/func/src/f63_17.htm, 8KB, , updated: 2000/4/7 11:19, local time: 2024/11/12 11:35,
TOP NEW HELP FIND: 
3.143.214.89:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/os/win/api/win32/func/src/f63_17.htm"> NetUserAdd</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?