Sets parameter information for wntUserAdd. (This function sets values for elements in a user parameter structure, which is used by the wntUserAdd function.)
wntUserAddDat( element, value)
(s) element: see below.
(s/i) value: see below.
(i) @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 ("").
wntUserAdd can also add a workstation to a domain.
The server-name parameter requires a valid servername.
The user-name parameter, should be a computer (workstation) name (in upper case) with a trailing '$'.
You should specify password, as the workstation name without the '$'.
Here is an example:
WktoAdd="WORK001$" ; make sure uppercase with trailing $ wntUserAddDat("name", NametoAdd) wntUserAddDat("password", StrSub(WktoAdd,0,StrLen(NametoAdd)-1)) ; 4096 - This is a computer account for a Windows NT ; Workstation or Windows NT Server that is a member of ; this domain. wntUserAddDat("flags", 4096+1) wntUserAdd("\\server")
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):
A STRING containing the path of the home directory of the user specified in "user_name". The STRING can be null.
"comment" (s):
A STRING that contains a comment. The STRING can be a null STRING, or it can have any number of characters.
"flags" (i):
Contains values that determine several features. This element can be any of the following values:
Value |
Name |
Meaning |
1 |
NORMAL |
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. |
65535 |
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):
A string specifying the path of the user's logon script, .CMD, .EXE, or .BAT file. The STRING can be null.
"full_name" (s):
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):
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):
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.
"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.
; Load Appropriate Extender AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')
;Example to add a computer to the domain daserver="\\server" computername="work001" NametoAdd=StrUpper(StrCat(computername,"$")) wntUserAddDat("name", NametoAdd) wntUserAddDat("flags", 4096+1); wntUserAddDat("acct_expires", "0000:00:00:00:00:00") wntUserAdd(daserver) Exit