User Functions
The network management user functions control a user's account in the security database, which is the security accounts manager (SAM) database or, in the case of domain controllers, the Active Directory. The user functions are listed following.
Function | Description |
---|---|
NetUserAdd | Adds a user account and assigns a password and privilege level. |
NetUserChangePassword | Changes a user's password for a specified network server or domain. |
NetUserDel | Deletes a user account from the server. |
NetUserEnum | Lists all user accounts on a server. |
NetUserGetGroups | Returns a list of global group names to which a user belongs. |
NetUserGetInfo | Returns information about a particular user account on a server. |
NetUserGetLocalGroups | Returns a list of local group names to which a user belongs. |
NetUserSetGroups | Sets global group memberships for a specified user account. |
NetUserSetInfo | Sets the password and other elements of a user account. |
Each user or application that accesses network resources must have an account in the security database. The directory services use this account to verify that the user or application has permission to connect to a resource. When a user or an application requests access to a resource, the Windows security system checks for an appropriate user account or group account to permit the access.
Once you remove a user account by calling the NetUserDel function, the user can no longer access the server except by using the guest account.
Because a user's password is confidential, it is not returned by the NetUserEnum function or the NetUserGetInfo function. The password is initially assigned when you call NetUserAdd.
User account information is available at the following levels:
- USER_INFO_0
- USER_INFO_1
- USER_INFO_2
- USER_INFO_3
- USER_INFO_4
- USER_INFO_10
- USER_INFO_11
- USER_INFO_20
- USER_INFO_21
- USER_INFO_22
- USER_INFO_23
In addition, the following information levels are valid when you call the NetUserSetInfo function:
- USER_INFO_1003
- USER_INFO_1005
- USER_INFO_1006
- USER_INFO_1007
- USER_INFO_1008
- USER_INFO_1009
- USER_INFO_1010
- USER_INFO_1011
- USER_INFO_1012
- USER_INFO_1014
- USER_INFO_1017
- USER_INFO_1020
- USER_INFO_1024
- USER_INFO_1051
- USER_INFO_1052
- USER_INFO_1053
The following functions enable applications to check password compliance.
Function | Description |
---|---|
NetValidatePasswordPolicyFree | Frees the memory allocated by the NetValidatePasswordPolicy function. |
NetValidatePasswordPolicy | Verifies that passwords meet complexity, aging, minimum length, and history reuse requirements. |
If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to achieve the same functionality you can achieve by calling the network management user functions. For more information, see IADsUser and IADsComputer.