wntUserSetDat

Modifies parameter information for a user account.

Syntax:

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

Parameters:

(s) server-name: is the name of the server on which the function will execute, or a blank string ("") to indicate the current machine.

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

(s) element: See below.

(s) value: 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:

(s) @TRUE on success, @FALSE if there was a problem.

 

If "element" and "value" are both set to blank strings (""), all values will be cleared from the user parameter structure.

 

You can specify a value of "*NULL*" to set a string element to a NULL pointer, which is not the same as a NULL string ("").

 

Note: This function cannot rename an account. It can only modify parameter information for a user account. To rename a account use the function

Elements

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.

 

"password" (s):

The password for the user specified in the "name" element. The length cannot exceed 256 bytes. By convention, Windows NT limits the length of passwords to 14 characters. This convention allows LAN Manager, Windows 3.x, Windows for Workgroups 3.x, and Windows 95 clients to access a Windows NT server using the account.

 

"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".

 

Note: "value" must contain a 4-digit year, and must appear in the precise format "YYYY:MM:DD:hh:mm:ss" (ie, exactly 19 characters long, with colons in exactly the right positions). 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.

 

"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. Note: This element cannot be set using wntUserAddDat.

 

"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.

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

; ADD additional flags to an account ; and preserve original user settings flags=wntUserGetDat("","joed","flags",0) flags=flags | 2 wntUserSetDat("","joed","flags",flags,0) Exit
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

; REMOVE a single flag from an account ; and preserve all other user settings flags=wntUserGetDat("","joed","flags",0) flags=flags & (~2); Note: tilde not minus wntUserSetDat("","joed","flags",flags,0) Exit

 

See Also:

wntUserAddDat, wntUserGetDat, wntUserRename, wntUserInfo