The user functions control a user's account in the security database. The user functions are:
NetUserAdd
NetUserChangePassword
NetUserDel
NetUserEnum
NetUserGetGroups
NetUserGetInfo
NetUserGetLocalGroups
NetUserSetGroups
NetUserSetInfo
Each user or application that accesses resources must have an account in the security database. The Windows NT server directory services use this user account to verify that the user or application has permission to use a resource. When a user or an application requests access to a resource, the security system checks for an appropriate user account or group account to permit the access.
The NetUserEnum can be used to list all user accounts in a domain. An application can verify the groups to which a user belongs by calling NetUserGetGroups, which returns a list of global group names. The NetUserGetLocalGroups function does the same for local groups. When a user account is no longer needed, use NetUserDel to delete the account from the server. Once the account is removed, the user can no longer access the server, except by using the guest account. Because the user's password is confidential, it is not returned by NetUserEnum or NetUserGetInfo. The password is initially assigned when NetUserAdd is called. NetUserChangePassword function changes a user's password for a specified network server or domain. The NetUserSetInfo function sets the password and other elements of a user account.
User account information is available at seven levels:
USER_INFO_0
USER_INFO_1
USER_INFO_2
USER_INFO_3
USER_INFO_10
USER_INFO_11
USER_INFO_20
The following information levels are valid only for NetUserSetInfo:
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_1013
USER_INFO_1014
USER_INFO_1017
USER_INFO_1018
USER_INFO_1020
USER_INFO_1023
USER_INFO_1024
USER_INFO_1025
USER_INFO_1051
USER_INFO_1052
USER_INFO_1053
For NetUserSetInfo, parmnum values refer to the members of the USER_INFO structure, as follows. These values are used when indicating an error in a specific parameter through parm_err.
parmnum value | Member of user_info structure |
USER_NAME_PARMNUM | usri_name |
USER_PASSWORD_PARMNUM | usri_password |
USER_PASSWORD_AGE_PARMNUM | usri_password_age |
USER_PRIV_PARMNUM | usri_priv |
USER_HOME_DIR_PARMNUM | usri_home_dir |
USER_COMMENT_PARMNUM | usri_comment |
USER_FLAGS_PARMNUM | usri_flags |
USER_SCRIPT_PATH_PARMNUM | usri_script_path |
USER_AUTH_FLAGS_PARMNUM | usri_auth_flags |
USER_FULL_NAME_PARMNUM | usri_full_name |
USER_USR_COMMENT_PARMNUM | usri_usr_comment |
USER_PARMS_PARMNUM | usri_parms |
USER_WORKSTATIONS_PARMNUM | usri_workstations |
USER_LAST_LOGON_PARMNUM | usri_last_logon |
USER_LAST_LOGOFF_PARMNUM | usri_last_logoff |
USER_ACCT_EXPIRES_PARMNUM | usri_acct_expires |
USER_MAX_STORAGE_PARMNUM | usri_max_storage |
USER_UNITS_PER_WEEK_PARMNUM | usri_units_per_week |
USER_LOGON_HOURS_PARMNUM | usri_logon_hours |
USER_PAD_PW_COUNT_PARMNUM | usri_bad_pw_count |
USER_NUM_LOGONS_PARMNUM | usri_num_logons |
USER_LOGON_SERVER_PARMNUM | usri_logon_server |
USER_COUNTRY_CODE_PARMNUM | usri_country_code |
USER_CODE_PAGE_PARMNUM | usri_code_page |
USER_PRIMARY_GROUP_PARMNUM | usri_primary_group_id |
USER_PROFILE | usri_profile |
USER_HOME_DIR_DRIVE_PARMNUM | usri_home_dir_drive |