Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help - VBScript Error

Status
Not open for further replies.

tgcfl

IS-IT--Management
Mar 14, 2008
3
US
When I attempt to execute the below script, I receive an error "Variable Uses an Automation Type Not Supported in VBScript". What the script should do is to read from an application's user database and then insert the data it collects (including the date the script was run and the machine name from where it was run) into a SQL Server database. If someone could tell me where I've gone wrong I'd REALLY appreciate it.

<job id="Export_Userids">
<runtime>
<description>
</description>
</runtime>

<object id="iLETS" progid="iCONECT.iLETS"/>
<script language="VBScript">

Dim AllTheUsers
Dim ClientsAndCases
Dim OneUser
Dim UserName
Dim UserID
Dim EmailAddress
Dim FirstName
Dim LastName
Dim IsActive
Dim Description

Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set AllTheUsers = iLETS.AllUsers
Set objComputer = CreateObject("Shell.LocalMachine")

Dim ProgressBar

Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Driver={SQL Server};" & _
"Server=xxx.xxx.xxx.x;" & _
"Database=xxxxxxx;" & _
"user id=xxxxxxx;" & _
"password=xxxxxx;"
Set objRSSQL = CreateObject("ADODB.Recordset")

LowerBound = AllTheUsers.LowerBound
UpperBound = AllTheUsers.UpperBound
J = 1
For I = LowerBound To UpperBound
Set OneUser = AllTheUsers.UserAt (I)
UserName = OneUser.Name
UserID = OneUser.ID
EmailAddress = OneUser.EmailAddress
FirstName = OneUser.FirstName
LastName = OneUser.LastName
Phone = OneUser.ContactNumber
IsActive = OneUser.IsActive
Description = OneUser.Description
SQLQuery = "insert into tbliconectusers (UserName, UserID, EmailAddress, FirstName, LastName, Phone, Server)" & _
" values ('" & UserName & "','" & UserID & "','" & EmailAddress & "','" & FirstName & "','" & LastName & "'," & Phone & "','" & objComputer.MachineName & "')"
J = J + 1
Next

WScript.Echo "List of Users Exported."

</script>
</job>
 
As iconect.ilets is your own com object, you would be on your own to identify the variable type. On the face of it, I would probably suspect .id return some Byte() variable type? that would not be supported in the ordinary way. On the error line (suppost it is .id line, for instance) insert something like this for the discovery of variable type.
[tt]
UserID = OneUser.ID
[blue]wscript.echo typename(UserID)[/blue]
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top