User Object

The User object represents a Windows NT local or domain user account. It can be obtained via the UserManager.GetUser method, or UserManager.Users and UserManager.LocalUsers collections.

User Properties

NOTE: Unless stated otherwise, all read/write and write-only properties must be saved by calling User.SetInfo.
Property Type/Access
(R) - read-only; (W) - write-only; (RW) - read/write.
Comments
Name String (R) Name of the user account. Default property.
Comment String (RW) User account's description.
FullName String (RW) User's full name.
Password String (W) Account's password. Use this property to set a user's new password. Does not return a valid value since Windows NT passwords are always scrambled.
PasswordAge Long (R) Specifies the number of seconds elapsed since the account's password was last changed.
MustChangePassword Boolean (RW) Specifies whether the password of the user has expired.
CannotChangePassword Boolean (RW) Specifies whether a user can change his/her password.
PasswordNeverExpires Boolean (RW) Specifies whether the password should expire.
AccountDisabled Boolean (RW) Specifies whether the account is disabled. 
AccountLockedOut Boolean (RW) Specifies whether the account is locked out.
Privilege Integer (R) Returns one of three values to specify the level of privilege assigned to this account. Can be one of the following:
USER_PRIV_GUEST (0) - Guest;
USER_PRIV_USER (1) - User;
USER_PRIV_ADMIN (2) - Administrator.
HomeDir String (RW) Specified the path to the home directory of this user.
Flags Long (RW) Contains user account flags. It is not recommended to modify this property directly, use Boolean properties listed above instead.
ScriptPath String (RW) Specifies the path of the user's logon script.
AuthFlags Long (R) Specifies the user's operator privileges. Can be one of the following values:
AF_OP_PRINT (1) - Print operator;
AF_OP_COMM (2) - Communications operator;
AF_OP_SERVER (4) - Server operator;
AF_OP_ACCOUNTS (8) - Accounts operator.
UserComments String (RW) Specifies a user comment.
Parms String (RW) Microsoft products use this property to store user configuration information. Do not modify this information.
Workstations String (RW) Contains the comma-separated names of workstations from which the user can log on.
LastLogon Date (R) Specifies when the last logon occurred.
LastLogoff Date (R) Specifies when the last logoff occurred.
AccountExpires Date (RW) Specifies when the account will expire. Returns 9/9/9999 if the account never expires.
MaxStorage Long (RW) Specifies the maximum amount of disk space the user can use. Use USER_MAXSTORAGE_UNLIMITED (-1) to use all available disk space. 
BadPasswordCount Long (R) Specifies the number of times the user tried to log on to the account using an incorrect password. A value of &HFFFFFFFF indicates that the value is unknown. 
NumberOfLogons Long (R) Counts the number of successful times the user tried to log on to this account. A value of &HFFFFFFFF indicates that the value is unknown.
LogonServer String (R) Contains the name of the server to which logon requests are sent. Server names should be preceded by two backslashes (\\). A servername of an asterisk (\\*) indicates that the logon request can be handled by any logon server. 
CountryCode Long (RW) Specifies the country code for the user's language of choice. 
CodePage Long (RW) Specifies the code page for the user's language of choice. 
PrimaryGroupID Long (RW)

Specifies the relative ID (RID) of the Primary Global Group for this user. If you want to change this user's Primary Group info, set this property to a value returned by the Group.RID property of an appropriate group.

You can also use one of the following well-known RID values (defined in AspUser.inc):
DOMAIN_GROUP_RID_ADMINS (&H200)
DOMAIN_GROUP_RID_USERS (&H201)
DOMAIN_GROUP_RID_GUESTS (&H202)

Profile String (RW) Specifies a path to the user's profile.
HomeDirDrive String (RW) Specifies the drive letter assigned to the user's home directory for logon purposes.
Groups IGroups Object (R) Returns the Groups collection of Domain groups this user belongs to. If this is a local user, the collection is always empty.
LocalGroups IGroups Object (R) Returns the Groups collection of local groups this user belongs to.
IsLocal Boolean (R) Returns True if this is a local user (i.e. this object is obtained via UserManager.LocalUsers or UserManager.GetUser( ..., False ).
Dialin Boolean (R) Returns True if dial-in permission is enabled for this user. Use User.SetDialinPermission method to change this property

As of version 1.2, this property is no longer supported.

CallBackType Integer (R) Returns the dial-in call back type. Possible values are: 
1 - No call back. 
2 - Set by caller. 
3 - Preset by administrator. 

Use User.SetDialinPermission method to change this property.

As of version 1.2, this property is no longer supported.

PhoneNumber String (R) Returns the administrator-set phone number. The value returned is only valid if User.CallBackType = 3 (Preset by administrator). 
Use User.SetDialinPermission method to change this property.

As of version 1.2, this property is no longer supported.

IsGroup Boolean (R) Normally set to False. Returns True if this object represents a group in a collection returned by Group.Members. See the description of the Group.Members property for more info.

User Methods
Method Arguments / Return type (if applicable) Comments
AddToGroup

GroupName As String;

Optional IsDomain.

Adds this user to the specified group. IsDomain specifies whether GroupName is a global group (if True) or a local group (if False). This parameter is made optional for backward compatibility with AspNTUser. You must always set it.
DeleteFromGroup

GroupName As String;

Optional IsDomain.

Deletes this user from the specified group. IsDomain specifies whether GroupName is a global group (if True) or a local group (if False). This parameter is made optional to provide backward compatibility with AspNTUser. You must always set it.
SetInfo   Saves information specified via the User read/write and write-only properties to the Windows NT account database. 
Rename  NewName As String Renames this user.
SetDialinPermission CallBackType As Integer;
Optional Enable = True;
Optional PhoneNumber = "".
Sets dial-in permission properties for this user. 
CallBackType specifies the dial-in call back type (see User.CallBackType property for possible values). 

Enable = True (default) enables dial-in permission. Enable = False disables it. 

PhoneNumber specifies the administrator-set callback phone number. Ignored unless CallBackType = 3. Empty by default.

As of version 1.2, this method is no longer supported.