FR 
 
Site navigation



User Management Resource Administrator: User Account Management for Windows 2003/XP/2000/NT

Previous Topic

Next Topic

Book Contents

Visual Basic Script

The Visual Basic script can be found at the location

.\Example Projects\Automation\VBScript\MsAccess\ CreateAccountAccess.vbs

relative to the UMRA Console program directory.

The following listing shows the complete script. Note that the script is kept as simple as possible to make it easier to understand. More error handling should be added to the script in operational environments.

Dim adoConn, adoRS

Set adoConn = CreateObject("ADODB.Connection")

Set adoRS = CreateObject("ADODB.Recordset")

adoConn.Provider = "Microsoft.Jet.OLEDB.4.0"

adoConn.Open "FirstLastNames.mdb"

Set adoRS.ActiveConnection = adoConn

adoRS.Open "SELECT * FROM FirstLastNamesTable"

Dim Umra, Username, UserPassword

Set Umra = CreateObject("UmraCom.Umra")

RetVal = Umra.Connect("AMAZONE", 56814)

While adoRS.EOF = False

Umra.SetVariableText "%Firstname%", adoRS("FirstName")

Umra.SetVariableText "%LastName%", adoRS("LastName")

RetVal=Umra.ExecuteProjectScript("CreateAccount")

RetVal=Umra.GetVariableText("%Username%", Username)

RetVal=Umra.GetVariableText("%Password%", UserPassword)

wscript.echo "User created: " & Username & " - " & UserPassword

adoRS.MoveNext

Wend

If RetVal = 0 Then

WScript.Echo "Project executed successfully, code: " & RetVal

Else

WScript.Echo "Project execution failed, code: " & RetVal

End If

In the next section, parts of the scripts are shown with some comments for each section.

See Also

Visual Basic script

Script section: Setting up the database connection

Script section: Connecting to the UMRA Service

Script section: Executing projects on UMRA Service

Testing and executing the script


Home | Products | Support | Pricing | Download | Press | About Us | Contact | Sitemap
QUICK LINKS: Mass / Bulk Import Software | Network Monitoring Software | Disk Quota Management
QUICK LINKS: User and Active Directory Management | Active Directory Migration | SSRPM Documentation