The NetUserEnum function provides information about all user accounts on a server.
Only members of the Administrators or Account operators local group can successfully execute NetUserEnum at levels 1 and 2. No special group membership is required at level 0 or 10.
NET_API_STATUS NetUserEnum(
LPWSTR servername, | |
DWORD level, | |
DWORD filter, | |
LPBYTE *bufptr, | |
DWORD prefmaxlen, | |
LPDWORD entriesread, | |
LPDWORD totalentries, | |
LPDWORD resume_handle | |
); |
Value |
Meaning |
0 |
The bufptr parameter points to an array of USER_INFO_0 structures. |
1 |
The bufptr parameter points to an array of USER_INFO_1 structures. |
2 |
The bufptr parameter points to an array of USER_INFO_2 structures. |
3 |
The bufptr parameter points to an array of USER_INFO_3 structures. |
10 |
The bufptr parameter points to an array of USER_INFO_10 structures. |
11 |
The bufptr parameter points to an array of USER_INFO_11 structures. |
12 |
The bufptr parameter points to an array of USER_INFO_20 structures. |
Value |
Meaning |
FILTER_TEMP_DUPLICATE_ACCOUNTS |
Enumerates local user account data on a domain controller. |
FILTER_NORMAL_ACCOUNT |
Enumerates global user account data on a computer. |
FILTER_INTERDOMAIN_TRUST_ACCOUNT |
Enumerates domain trust account data on a domain controller. |
FILTER_WORKSTATION_TRUST_ACCOUNT |
Enumerates workstation or member server account data on a domain controller. |
FILTER_SERVER_TRUST_ACCOUNT |
Enumerates domain controller account data on a domain controller. |
If the function is successful, it returns 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 |
The computer name is invalid. |
ERROR_MORE_DATA |
More entries are available with subsequent calls. |
The NetUserEnum function returns the full set of USER_INFO_0 or USER_INFO_1 components. If level is set to 1, the password component of each data structure will be set to NULL to maintain password security. The NetUserEnum does not return all Windows NT system users. It returns only those users who have been added by the NetUserAdd function.
NetUserGetGroups, NetUserGetInfo, USER_INFO_0, USER_INFO_1, NetUserAdd