View Single Post
Old 12-04-2017, 02:50 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
Join Date: Jan 2017
Posts: 654
Hi VanDyke82nev,

Is your goal to import SecureCRT sessions or to gather the data from the end devices? Currently it is not possible to import passwords into SecureCRT sessions. If however, you do not need to save connections, we may be able to help with getting the data from your end devices.

Using the example data you provided I've mocked up a script that would read the data from Excel and connect to the JumpServer, once connected you could then issue the command the JumpServer requires to connect to the end device also using the data read from your Excel sheet.

# $language = "VBScript"
# $interface = "1.0"

strFilePath = "C:\Path\to\ServerList.xlsx"

Set objExcel = CreateObject("Excel.Application")
Set objWkbk = objExcel.Workbooks.Open(strFilePath)
Set objSheet = objWkbk.Sheets(1)

For Each objRow in objSheet.Rows
    If objRow.Row > 1 Then
        strJumpAddr = objRow.Cells(1,1).value
        strJumpUser = objRow.Cells(1,2).value
        strJumpPass = objRow.Cells(1,3).value
        strSrvrAddr = objRow.Cells(1,4).value
        strSrvrUser = objRow.Cells(1,5).value
        strSrvrPass = objRow.Cells(1,6).value

        If strJumpAddr = "" Then
            Exit For
        End If
        'Example of using the data read from Excel
        'crt.Dialog.MessageBox(strJumpAddr & vbcrlf &_
        '    strJumpUser & vbcrlf &_
        '    strJumpPass & vbcrlf &_
        '    strSrvrAddr & vbcrlf &_
        '    strSrvrUser & vbcrlf &_
        '    strSrvrPass & vbcrlf)
        Set objNewTab = crt.Session.ConnectInTab("/SSH2 /PASSWORD " &_
                                                strJumpPass & " " &_
                                                strJumpUser & "@" & strJumpAddr)
        'Wait for screen to stop changing
        'Command jump host requires to connect to end device
        'crt.Screen.Send("ssh " & strSrvrUser & "@" & strSrvrAddr)
        'Authentication for end device
        'Wait for screen to stop changing
        'Commands to collect your needed data
    End If

The example script found here includes functions that demonstrate handling authentication and waiting for the screen contents to stop changing before sending the next command.

Does this help you get the functionality you're looking for?

VanDyke Software
Technical Support
(505) 332-5730

Last edited by bgagnon; 12-04-2017 at 04:43 PM.
Reply With Quote