wntUserGetDat

Returns parameter information for a user account.

Syntax:

wntUserGetDat(server-name, user-name, element [, input-format-flag])

Parameters:

(s) server-name: is the UNC name of the server on which the function will execute (eg, "\\MYSERVER"), or "" for the local computer.

(s) user-name: name of a user who has an account on "server-name".

(s) element: specifies the element to be returned. See below.

(i) input-format-flag: [optional] controls how the user-name parameter value is interpreted.
Value
 Meaning
0 (default) user-name of an actual user account name.
1 user-name contains a SID value instead of an actual user account name.

Returns:

(i) Returns a string or integer value, depending on "element"..

 

Element

Can be one of the following elements in the structure. Its type (string or integer) is shown in parentheses, followed by a description of its corresponding "value":

 

"name" (s):

Specifies the name of the user account. The number of characters in the name cannot exceed 256.

 

"home_dir" (s):

Points to a string containing the path of the home directory of the user specified in "user_name". The string can be null.

 

"comment" (s):

Points to a string that contains a comment. The string can be a null string, or it can have any number of characters before the terminating null character.

 

"flags" (i):

Contains values that determine several features. This element can be any of the following values:

 

Value

Name

Meaning

1

Normal Account

This flag is REQUIRED for new accounts

2

UF_ACCOUNTDISABLE

The user's account is disabled.

8

UF_HOMEDIR_REQUIRED

The home directory is required. This value is ignored in Windows NT.

16

UF_LOCKOUT

The account is currently locked out.

32

UF_PASSWRD_NOTREQD

No password is required.

64

UF_PASSWRD_CANT_CHANGE

The user cannot change the password.

65536

UF_DONT_EXPIRE_PASSWD

Don't expire password.

 

The following values describe the account type. Only one value can be set.

 

Value

Name

Meaning

256

UF_TEMP_DUPLICATE
_ACCOUNT

This is an account for users whose primary account is in another domain. This domain, but not to any domain that trusts this domain. The User Manager refers to this account type as a local user account.

512

UF_NORMAL_ACCOUNT

This is a default account type that represents a typical user.

2048

UF_INTERDOMAIN_TRUST
_ACCOUNT

This is a permit to trust account for a Windows NT domain that trusts other domains.

4096

UF_WORKSTATION_TRUST
_ACCOUNT

This is a computer account for a Windows NT Workstation or Windows NT Server that is a member of this domain.

8192

UF_SERVER_TRUST
_ACCOUNT

This is a computer account for a Windows NT Backup Domain Controller that is a member of this domain.

 

"script_path" (s):

Points to a string specifying the path of the user's logon script, .CMD, .EXE, or .BAT file. The string can be null.

 

"full_name" (s):

Points to a string that contains the full name of the user. This string can be a null string, or it can have any number of characters before the terminating null character.

 

"usr_comment" (s):

Points to a string that contains a user comment. This string can be a null string, or it can have any number of characters before the terminating null character.

 

"workstations" (s):

Points to a string that contains the names of workstations from which the user can log on. As many as eight workstations can be specified; the names must be separated by commas (,). If you do not want to restrict the number of workstations, use a null string. To disable logons from all workstations to this account, set the UF_ACCOUNTDISABLE (2) value in the "flags" element.

 

"acct_expires" (i):

Specifies when the account will expire. To indicate that the account should have no expiration date, specify "0000:00:00:00:00:00".

 

"max_storage" (i):

Specifies the maximum amount of disk space the user can use. Use -1 to use all available disk space.

 

"logon_hours" (s):

Points to a 21-byte (168 bits) bit string that specifies the times during which the user can log on. Each bit represents a unique hour in the week. The first bit (bit 0, word 0) is Sunday, 0:00 to 0:59; the second bit (bit 1, word 0) is Sunday, 1:00 to 1:59; and so on. A null pointer in this element means there is no time restriction.

 

Note: Bit 0 in word 0 represents Sunday from 0:00 to 0:59 only if you are in the GMT time zone. In all other cases you must adjust the bits according to your time zone offset (for example, GMT minus 8 hours for PST).

 

"country_code" (i):

Specifies the country code for the user's language of choice.

 

"code_page" (i):

Specifies the code page for the user's language of choice.

 

"profile" (s):

Specifies a path to the user's profile. This value can be a null string, a local absolute path, or a UNC path.

 

"home_dir_drive" (s):

Specifies the drive letter assigned to the user's home directory for logon purposes.

 

"password_expired" (i):

Determines whether the password of the user has expired. Specify nonzero to indicate that the user must change password at next logon.

 

***********************************************************************************************************
Note:
The following elements cannot be set using wntUserAddDat or wntUserSetDat.
***********************************************************************************************************

"user_id" (i):
User's RID (relative identifier).

 

"primary_group_id" (i):
RID (relative ID) of the user's primary global group. You can determine a group's RID using wntGroupInfo with request = 2.

 

"password_age" (i):

Specifies the number of seconds elapsed since the password was last changed.

 

"priv" (s):

One of the following values, specifying the level of privilege assigned the user:

Value

Name

Meaning

0

USER_PRIV_GUEST

Guest

1

USER_PRIV_USER

User

2

USER_PRIV_ADMIN

Administrator

 

"auth_flags" (i):

Specifies the user's operator privileges, based on local group membership. This element can be any of the following values:

Value

Name

Meaning

1

AF_OP_PRINT

The print operator privilege is enabled.

2

AF_OP_COMM

The communications operator privilege is enabled.

4

AF_OP_SERVER

The server operator privilege is enabled.

8

AF_OP_ACCOUNTS

The accounts operator privilege is enabled.

 

parms" (i):

A string that is set aside for use by applications. This can be a string of any length, or a blank string. Microsoft products use this element to store user configuration information.

 

"units_per_week" (i):

Specifies the number of equal-length time units into which the week is divided in order to compute the length of the bit string in "logon_hours". This value must be 168 (ie, hours per week) for LAN Manager 2.0. For Windows NT services, this value must be 7, 168, or 10080 (days, hours, or minutes per week, respectively).

 

"usri3_bad_pw_count" (i):

Specifies the number of times the user tried to log on to the account using an incorrect password. A value of -1 indicates that the value is unknown. This element is maintained separately on each Backup Domain Controller (BDC) in the domain. To get an accurate value, each BDC in the domain must be queried, and the largest value is used.

 

"num_logons" (i):

Specifies the number of successful times the user tried to log on to this account. A value of -1 indicates that the value is unknown. This element is maintained separately on each Backup Domain Controller (BDC) in the domain. To get an accurate value, each BDC in the domain must be queried, and the largest value is used.

 

"logon_server" (s):

A string that contains the name of the server to which logon requests are sent. Server names should be preceded by two backslashes ("\\"). A server name of an asterisk ("\\*") indicates that the logon request can be handled by any logon server. A blank string indicates that requests are sent to the domain controller. For Windows NT Servers, this will always return "\\*".

 

"last_logon" (s):

Last logon time, in "YYYY:MM:DD:hh:mm:ss" format. These times are maintained separately on each Backup Domain Controller (BDC) in the domain. To get an accurate value, each BDC in the domain must be queried, and the largest value is used.

 

The return value will always contain a 4-digit year. If no value is available, "0000:00:00:00:00:00" is returned.

 

"last_logoff" (s):

Last logoff time, in "YYYY:MM:DD:hh:mm:ss" format. These times are maintained separately on each Backup Domain Controller (BDC) in the domain. To get an accurate value, each BDC in the domain must be queried, and the largest value is used.

 

The return value will always contain a 4-digit year. If no value is available, "0000:00:00:00:00:00" is returned.

 

Example:
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

user="joe" theflags=wntUserGetDat("\\SERVER",user,"flags",0) If theflags & 2    Message(user,"Account Disabled") EndIf If theflags & 32    Message(user,"Password not required") EndIf Exit
See Also:

wntUserAddDat