UserManager Object

UserManager is the main top-level object that provides a considerable portion of AspUser's functionality, as well as serves as an "object factory" for the Group, User, FileOrDir, and Server objects.

In an ASP environment, UserManager can be created by the statement

<% Set AU = Server.CreateObject("Persits.AspUser") %>

or tag

<OBJECT RUNAT=SERVER PROGID="Persits.AspUser" ID=AU>
</OBJECT>

In a VB environment, the UserManager object can be created as follows (after checking the box next to "Persits Software AspUser 1.0" in the References dialog):

Dim AU As UserManager
Set AU = New UserManager
 

UserManager Properties
Property Type/Access
(R) - read-only; (W) - write-only; (RW) - read/write.
Comments
Domain String (RW) Specifies the domain on which all the "domain" commands will be executed, such as UserManager.Users or UserManager.Groups. Use this property only if you need to manage domains other that one the component in installed on. Otherwise leave this property empty.
Server String (RW) Use this property to specify the server on which all the LocalXXX commands will be executed, such as UserManager.LocalUsers or UserManager.LocalGroups. The server name must begin with '\\'. Leave empty if the local machine is used.
DomainController String (R) Returns the name of the primary domain controller for the current domain, or domain specified by the Domain property.
Groups IGroups Object (R) Returns the Groups collection of Domain groups for the current domain, or domain specified by the Domain property.
LocalGroups IGroups Object (R) Returns the Groups collection of local groups for the current server, or server specified by the Server property. 
Users IUsers Object (R) Returns the Users collection of the Domain users for the current domain, or domain specified by the Domain property
LocalUsers IUsers Object (R) Returns the Users collection of local users for the current server, or server specified by the Server property.
Servers IServers Object (R) Returns the Servers collection of servers visible from the current server and domain, or the server and domain specified by the Server and Domain properties, respectively.
IncludeErrorCode Boolean (RW)

False by default. If set to True, all exception messages generated by AspUser will begin with the corresponding genuine NT error codes in the Hex format, e.g. "0005 Access is denied." or
"08BC The user already belongs to this group."

Expires Date (R)

Returns the date/time when the component expires. If the value is "9/9/9999" the component never expires.

Version String (R)

Returns the current version of the component. This property was added in version 1.2.

UserManager Methods
Method Arguments / Return type (if applicable) Comments
LogonUser Domain As String
Username As String
Password As String
Optional LogonType = LOGON_INTERACTIVE
Impersonates the specified Windows NT user account. All of the following operations will be performed in the security context of this account. If Domain is empty, the local account database will be used to validate the password. 
The LogonType argument is optional. The possible values are: 

LOGON_INTERACTIVE (2), 
LOGON_NETWORK (3), 
LOGON_BATCH (4), 
LOGON_SERVICE (5).

RevertToSelf   Terminates impersonation begun by LogonUser.
ChangePassword Domain As String
Username As String
OldPassword As String
NewPassword As String
Changes a user’s password for a specified network server or domain. If Domain is empty, the local machine is assumed. If Username is in the format DOAMAIN\USERNAME the domain name prefix will be ignored.
AddLocalGroup Name As String
Comment As String

Returns: IGroup Object

Adds a new local group. Returns a Group object representing the newly created group, or Nothing if the creation failed.
AddGroup Name As String
Comment As String

Returns: IGroup Object

Adds a new domain group. Returns the Group object representing the newly created group, or Nothing if the creation failed. 
AddLocalUser Name As String
Password As String
Comment As String

Returns: IUser Object

Adds a new local user. Returns a User object representing the newly created user, or Nothing if the creation failed. 
Use the returned User object to set additional user account properties.
AddUser Name As String
Password As String
Comment As String

Returns: IUser Object

Adds a new domain user. Returns a User object representing the newly created user, or Nothing if the creation failed. 
Use the returned User object to set additional user account properties.
DeleteLocalGroup Name As String Deletes a local group.
DeleteGroup Name As String Deletes a domain group. 
DeleteLocalUser Name As String Deletes a local user account.
DeleteUser Name As String Deletes a domain user account.
GetGroup Name As String
Optional IsDomain = True

Returns: IGroup object

Returns a Group object. If IsDomain is True (default) a domain group object is returned, otherwise a local group object is returned. 

Unlike Groups and LocalGroups collections, this method allows you to retrieve a single group account without loading all group accounts into memory. Use this method if your NT account database contains a large number of groups.

GetUser Name As String
Optional IsDomain = True

Returns: IGroup object

Returns a User object. If IsDomain is True (default) a domain user object is returned, otherwise a local user object is returned. 

Unlike Users and LocalUsers collections, this method allows you to retrieve a single user account's information without loading all user accounts into memory. Use this method if your NT account database contains a large number of users.

GetUserName Returns: String Returns the name of the user currently logged onto the system. 
GetDomainName Returns: String Returns the current domain name, or domain name of the server specified by the Server property.
GetComputerName Returns: String Returns the name of the current server.
File Path As String
Returns: IFileOrDir Object
Returns a FileOrDir object representing a NTFS file or directory. You can use this object to manipulate Access Control Lists (ACLs) and attributes of that file.