Add New User |
|
AddNewUser(Server, Username, Password, [FullName], [UserComment]) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies the server you want to create the user on. Usually the domains PDC. |
Username | String | The desired username of the new user account account. |
Password | String | The password that the new account will use. |
Optional Arguments: |
FullName | String | Optional. If provided, the fullname specified here will be used for the user account. |
UserComment | String | Optional. If provided, the comment specified here will be used for the user account. |
|
Returns: |
True | If returns true, the account was successfully created on the server. |
False | If returns false, the account was not created on the server. See notes. |
|
Notes: |
Possible reasons this would fail: Insufficient permissions to create accounts, the specified username already exists, the password is shorter than the required length or you're using Windows 95/98. |
|
Example: |
Dim MyPDC As String
MyPDC = GetPDCName("MyDomainName")
If AddNewUser(MyPDC,"jdoe","John Doe","New anonymous user.") Then
MsgBox "User account was created successfully"
End If
|
Compatability: |
Windows 95/98 | Windows 2000/NT |
 |  |
|
Add User To Global Group |
|
AddUserToGlobalGroup(Server, Username, GlobalGroup) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies a PDC or BDC for the domain. |
Username | String | Specifies the user that you wish to add to the group. |
GlobalGroup | String | Specifies the global group that you wish to add the user to. |
Optional Arguments: |
|
Returns: |
True | If returns true, then the user was successfully added to the group. |
False | If returns false, the function was unable to add the user to the group. See notes. |
|
Notes: |
Possible reasons this would fail: Insufficient permissions to add to global group, unable to access the server or you're using Windows 95/98. |
|
Example: |
Dim MyPDC As String
MyPDC = GetPDCName("MyDomain")
If AddUserToGlobalGroup(MyPDC,"jdoe","Administrators") Then
MsgBox "Successfully added user to global group!"
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Add User To Local Group |
|
AddUserToLocalGroup(Server, Username, LocalGroup) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies the computer contains the local group you wish to add the user to. |
Username | String | Specifies the user that you wish to add to the group. |
LocalGroup | String | Specifies the local group that you wish to add the user to. |
Optional Arguments: |
|
Returns: |
True | If returns true, then the user was successfully added to the group. |
False | If returns false, the function was unable to add the user to the group. See notes. |
|
Notes: |
Possible reasons this would fail: Insufficient permissions to add the user to the local group, unable to access the server or you're using Windows 95/98. |
|
Example: |
AddUserToGlobalGroup("\\mycomputername","jdoe","Shared Access") |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Change User Password |
|
ChangePassword(Domain, Username, OldPassword, NewPassword) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Domain | String | Specifies the domain on which the specified user account resides. |
Username | String | Specifies the username whose password you want to change. |
OldPassword | String | The users current password. This can be left blank, if you have administrative permissions on the domain. |
NewPassword | String | The password you wish to change it to. |
Optional Arguments: |
|
Returns: |
True | If returns true then the password was successfully changed. |
False | If false then the function was unable to change the password. See Notes. |
|
Notes: |
Possible reasons this would fail: Insufficient permissions to change the password, unable to access the domain server or you're using Windows 95/98. |
|
Example: |
If ChangePassword("MyDomain","jdoe","mypassword","newpassword") Then
MsgBox "Password Successfully Changed!"
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Delete User Account From Domain |
|
DelUser(Server, Username) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies a PDC or BDC on the domain of the user account you wish to delete. |
Username | String | The username of the account you wish to delete. |
Optional Arguments: |
|
Returns: |
True | The user account was successfully deleted. |
False | The function was unable to delete the account. See Notes. |
|
Notes: |
Possible reasons this would fail: Insufficient permissions to delete the account, unable to access the server or you're using Windows 95/98. |
|
Example: |
Dim MyPDC As String
MyPDC = GetPDCName("MyDomain")
If MsgBox("Are you sure you want to delete the account?",vbYesNo)=vbYes Then
If DelUser(MyPDC,"jdoe") Then
MsgBox "The specified account has been deleted!"
End If
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Remove User From Global Group |
|
DelUserFromGlobalGroup(Server, Username, GlobalGroup) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | A PDC or BDC on the domain in which the user and group reside. |
Username | String | Specifies the user that you wish to remove from the group. |
GlobalGroup | String | Specifies the group that you wish to remove the user from. |
Optional Arguments: |
|
Returns: |
True | The user was successfully removed from the group. |
False | The function was unable to remove the user from the group. See Notes. |
|
Notes: |
Possible reasons this would fail: The group does not exist, insufficient permissions to remove the user from the group, unable to access the server or you're using Windows 95/98. |
|
Example: |
Dim MyPDC As String
MyPDC = GetPDCName("MyDomain")
If DelUserFromGlobalGroup(MyPDC,"jdoe","Administrators") Then
MsgBox "The user was successfully removed from the group."
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Remove User From Local Group |
|
DelUserFromLocalGroup(Server, Username, LocalGroup) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies the computer on which the local group resides. |
Username | String | Specifies the user that you would like to remove from the local group |
LocalGroup | String | Specifies the local group to remove the user from. |
Optional Arguments: |
|
Returns: |
True | The user was successfully removed from the local group. |
False | The function was unable to remove the user from the local group. See Notes. |
|
Notes: |
Possible reasons this would fail: The group does not exist, insufficient permissions to remove the user from the group, unable to access the server or you're using Windows 95/98. |
|
Example: |
If DelUserFromLocalGroup("\\mycomputername","jdoe","MyLocalGroup") Then
MsgBox "The user was successfully removed from the group."
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Enumerate Global Groups |
|
EnumGlobalGroups(Server, [Username]) As Variant |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies a PDC or BDC of the domain. |
Optional Arguments: |
Username | String | Optional. If a username is specified the function will enumerate all groups which that user is a member of. |
|
Returns: |
Array of Strings | If successful, an array of global groups will be returned. |
|
Notes: |
If unsuccesful, an error will be raised. |
|
Example: |
Dim MyPDC As String
Dim Group As Variant
MyPDC = GetPDCName("MyDomain")
For Each Group In EnumGlobalGroups(MyPDC)
MsgBox "The following global group exists: " & Group
Next
For Each Group In EnumGlobalGroups(MyPDC,"jdoe")
MsgBox "The user is a member of the following global group: " & Group
Next |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Enumerate Local Groups |
|
EnumLocalGroups(Server, [Username]) As Variant |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies the computer to retrieve the local groups from.. |
Optional Arguments: |
Username | String | Optional. If a username is specified the function will enumerate all groups which that user is a member of. |
|
Returns: |
Array of Strings | If successful, an array of local groups will be returned. |
|
Notes: |
If unsuccesful, an error will be raised. |
|
Example: |
Dim Group As Variant
For Each Group In EnumLocalGroups("\\acomputername")
MsgBox "The following local group exists on the computer: " & Group
Next
For Each Group In EnumLocalGroups("\\acomputername","jdoe")
MsgBox "The user is a member of the following local group on the computer: " & Group
Next |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Enumerate Users In A Global Group |
|
EnumUsersInGlobalGroup(Server, GlobalGroup) As Variant |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies a PDC or BDC on the domain. |
GlobalGroup | String | Specifies the global group you wish to retrieve members from. |
Optional Arguments: |
|
Returns: |
Array of Strings | If successful, an array of usernames will be returned. |
|
Notes: |
If unsuccessful, an error will be raised. |
|
Example: |
Dim MyPDC As String
Dim Username as String
MyPDC = GetPDCName("MyDomain")
For Each Username in EnumUsersInGlobalGroup(MyPDC,"Administrator")
Debug.Print "The following user is a member of the global group: " & Username
Next |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Enumerate Users In A Local Group |
|
EnumUsersInLocalGroup(Server, LocalGroup) As Variant |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies the computer on which the local group resides. |
LocalGroup | String | Specifies the local group you wish to obtain a member list from. |
Optional Arguments: |
|
Returns: |
Array of Strings | If successful, an array of usernames will be returned. |
|
Notes: |
If unsuccessful, an error will be raised. |
|
Example: |
Dim Username as String
For Each Username in EnumUsersInLocalGroup("\\acomputername","MyLocalGroup")
Debug.Print "The following user is a member of the local group: " & Username
Next |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Enumerate Users Currently Logged On |
|
EnumUsersLoggedOn(Server) As Variant |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies a PDC or BDC of the domain you wish to retrieve the currently logged on users from. |
Optional Arguments: |
|
Returns: |
Array of Strings | If successful, returns an array of usernames of users that are currently logged onto the domain. |
|
Notes: |
If unsuccessful, an error will be raised. This function might take a while (respective to the others) as it actually retrieves a list of all users on the domain, the gets each users "Last Logon Time" and "Last Logoff Time" and compares them. |
|
Example: |
Dim MyPDC As String
Dim LoggedOnUser As Variant
MyPDC = GetPDCName("MyDomain")
For Each LoggedOnUser In EnumUsersLoggedOn(MyPDC)
MsgBox LoggedOnUser & " is currently logged onto the domain."
Next |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Get The Computername Of A Primary Domain Controller (PDC) |
|
GetPDCName([Domain], [Server]) As String |
|
Required Arguments: |
|
Optional Arguments: |
Domain | String | Specifies the domain to retrieve the PDCs computername from. |
Server | String | Specifies the computer to retrieve the PDCs computername from. |
|
Returns: |
String | If successful, a string containing the computername of the PDC is returned. |
|
Notes: |
If unsuccessful, an error will be raised. You can specify a domain name or a server name or nothing, but do not try to specify both. If you specify a domain, the PDC for that domain will be returned. If you specify a server, the domain that the server is a member of will be returned. If neither a domain or server is specified, it will return the PDC of the domain that your computer is a member of. |
|
Example: |
Dim MyPDC As String
Dim AnotherPDC As String
MyPDC = GetPDCName()
AnotherPDC = GetPDCName("AnotherDomain")
AnotherPDC = GetPDCName( ,"\\somecomputer") |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Get User Information |
|
GetUserInfo(Server, Username) As USER_INFO |
|
Required Arguments: |
Name | Variable Type | Description |
Server | String | Specifies the PDC or BDC to retrieve the users information from. |
Username | String | Specifies the username to obtain the information from. |
Optional Arguments: |
|
Returns: |
USER_INFO | If successful, the users information will be returned using the USER_INFO structure. |
|
Notes: |
If unsuccessful, an error will be raised. Review the USER_INFO structure. |
|
Example: |
Dim MyPDC As String
Dim UsersInfo As USER_INFO
MyPDC = GetPDCName("MyDomain")
UsersInfo = GetUserInfo(MyPDC, "jdoe")
MsgBox "This information is about " & UsersInfo.Name
MsgBox "Users full name is: " & UsersInfo.Fullname
MsgBox "The comment in the account is: " & UsersInfo.Comment
MsgBox "The comment about the user is: " & UsersInfo.UserComment
|
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Logon To A Domain |
|
Login(Username, Password) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Username | String | Specifies the username to use to logon to the domain with. |
Password | String | Specifies the password to use to logon to the domain with. |
Optional Arguments: |
|
Returns: |
True | Returns true if it successfully logged your computer onto the domain. |
False | Returns false if it was unable to logon to the domain. |
|
Notes: |
The domain used to log onto is the default domain specified in your computers network settings. Possible failure reasons: Just about anything! (User account expired, not within user logon hours, incorrect password, non existant username, unable to reach a domain controller, etc...) |
|
Example: |
If Login("jdoe","mypass") Then
MsgBox "You have been successfully logged onto the domain.
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|
Set The Comment For A Computer |
|
SetServerComment(Comment,[Server]) As Boolean |
|
Required Arguments: |
Name | Variable Type | Description |
Comment | String | Specifies the comment to use. |
Optional Arguments: |
Server | String | Optional. Specifies the computer whose comment you wish to change. If left blank, your computer will be used. |
|
Returns: |
True | Comment was successfully changed. |
False | Unable to change comment. |
|
Notes: |
If Server is left blank, your computer will be used. Possible failure reasons: Insufficient permissions or unable to contact the computer. |
|
Example: |
If SetServerComment("This Is My Computer!") Then
MsgBox "Your comment has been successfully changed."
End If
If SetServerComment("This Is Another Computer!","\\anothercomputer") Then
MsgBox "The computers comment has been successfully changed."
End If |
Compatability: |
Windows 95/98 | Windows 2000/NT |  |  |
|