User Object

Overview

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. NOTE: Unless stated otherwise, all read/write and write-only properties must be saved by calling User.SetInfo.

Member List

Properties


AccountDisabled As Boolean (Read/Write)
Specifies whether the account is disabled.

AccountExpires As Boolean (Read/Write)
Specifies when the account will expire. Returns 9/9/9999 if the account never expires.

AccountLockedOut As Boolean (Read/Write)
Specifies whether the account is locked out.

AuthFlags As Long (Read-only)
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.

BadPasswordCount As Long (Read-only)
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.

CallBackType As Integer (Read-only)
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.

CannotChangePassword As Boolean (Read/Write)
Specifies whether a user can change his/her password.

CodePage As Long (Read/Write)
Specifies the code page for the user's language of choice.

Comment As String (Read/Write)
User account's description.

CountryCode As Long (Read/Write)
Specifies the country code for the user's language of choice.

Dialin As Boolean (Read-only)
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.

Flags As Long (Read/Write)
Contains user account flags. It is not recommended to modify this property directly, use Boolean properties listed above instead.

FullName As String (Read/Write)
User's full name.

Groups As IGroups (Read-only)
Returns the Groups collection of Domain groups this user belongs to. If this is a local user, the collection is always empty.

HomeDir As String (Read/Write)
Specified the path to the home directory of this user.

HomeDirDrive As String (Read/Write)
Specifies the drive letter assigned to the user's home directory for logon purposes.

IsGroup As Boolean (Read-only)
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.

IsLocal As Boolean (Read-only)
Returns True if this is a local user (i.e. this object is obtained via UserManager.LocalUsers or UserManager.GetUser( ..., False ).

LastLogoff As Date (Read-only)
Specifies when the last logoff occurred.

LastLogon As Date (Read-only)
Specifies when the last logon occurred.

LocalGroups As IGroups (Read-only)
Returns the Groups collection of local groups this user belongs to.

LogonServer As String (Read-only)
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.

MaxStorage As Long (Read/Write)
Specifies the maximum amount of disk space the user can use. Use USER_MAXSTORAGE_UNLIMITED (-1) to use all available disk space.

MustChangePassword As Boolean (Read/Write)
Specifies whether the password of the user has expired.

Name As String (Read-only)
Name of the user account. Default property.

NumberOfLogons As Long (Read-only)
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.

Parms As String (Read/Write)
Microsoft products use this property to store user configuration information. Do not modify this information.

Password As String (Write-only)
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 As Long (Read-only)
Specifies the number of seconds elapsed since the account's password was last changed.

PasswordNeverExpires As Boolean (Read/Write)
Specifies whether the password should expire.

PhoneNumber As String (Read-only)
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.

PrimaryGroupID As Long (Read/Write)
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)

Privilege As Integer (Read-only)
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.

Profile As String (Read/Write)
Specifies a path to the user's profile.

ScriptPath As String (Read/Write)
Specifies the path of the user's logon script.

UserComments As String (Read/Write)
Microsoft products use this property to store user configuration information. Do not modify this information.

Workstations As String (Read/Write)
Contains the comma-separated names of workstations from which the user can log on.

Methods


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

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

Sub Rename(NewName As String)
Renames this user.

Sub SetDialinPermission(CallBackType As Integer, Optional Enable = True, Optional PhoneNumber = "")
Renames this user.

Sub SetInfo()
Saves information specified via the User read/write and write-only properties to the Windows NT account database.