Hi
I'm trying to use VBScript to maintain our device database. I keep getting "Type mismatch" when calling "SaveDevice" for new or updated devices, and I can't see why. To test, I've taken the example code from your help file, made what I think are required changes for VBScript, and tried that. It also gets type mismatch errors. Clearly the change from VB to VBScript requires more than this. Can you tell me what I need to do? This is the sample code as converted:
Dim DB, Device
Set DB = CreateObject("CatToolsAPI.Database")
If DB.OpenConnection Then
Set Device = DB.Devices.AddNew("Cisco.Router.General")
If Not Device Is Nothing Then
Device.Name = "My Device 01"
Device.HostAddress = "192.168.1.1"
Device.Group = "My Test Group"
Device.RequireVTYLogin = True
Device.ConnectionMethod = "Telnet"
If DB.Devices.SaveDevice(Device) Then
Wscript.Echo Device.Name & " saved to the database OK."
Else
Wscript.Echo "Adding " & Device.Name & " failed: " & DB.ErrDescription
End If
Else
Wscript.Echo "Creation of a new device failed: " & DB.ErrDescription
End If
Else
Wscript.Echo "DB connection failed: " & DB.ErrDescription
End If
Set Device = Nothing
Set DB = Nothing