View Single Post
  #1  
Old 05-03-2019, 03:49 AM
vikram1840 vikram1840 is offline
Registered User
 
Join Date: May 2019
Posts: 20
VBS Script showing error

Hello Experts,
I am using securecrt8.5 and want to connect session through VBS script.
In general while connecting the session manually it ask about username,pswd and neId as well and after putting all info it get connect. But the same while i am doing through VBS script it showing error of connection failed.

Point to note-required server is having port other than 22 and apart from it required neId as well. so pleas guide me to run this script succfully.


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

  Sub Main

    Dim pass
    Dim session_name
    Dim password
    Dim user_name
    Dim log_file

    Hostname = "100.100.10.10"
    user_name = "usernm"
    password = "pswd"
    neId = "ABCD-GHIJK-LMNP"
    log_file = "C:\Users\vikramku\Desktop\OSS Connect Macro\Logs\logs.txt"

    crt.Session.LogFileName = log_file
    crt.Session.Log True

    cmd = "/SSH2 /P 8022 /L " & user_name & "/PASSWORD " & password & "/neId" & neId &  " /C 3DES /M MD5 " & Hostname 
    crt.Session.Connect cmd

    crt.Screen.send "amos ABCD" & vbCr
    login = crt.Screen.WaitForStrings(">", "Not OK")
    If login = 2 Then
      MsgBox "Information : ABCD is not Reachable, Please click ok to continue.", vbExclamation
    Else
      crt.Screen.send "lt all" & vbCr
      crt.Screen.send "st cell" & vbCr
      crt.screen.send "exit" & vbCr
      crt.Screen.WaitForString "Bye..."
    End if

    crt.screen.send "exit" & vbCr
    crt.screen.synchronous = false
    crt.Screen.WaitForString "logout"

    crt.Session.Log False
    crt.Session.Disconnect
    crt.Quit

  End Sub

Last edited by jdev; 05-03-2019 at 09:36 AM.
Reply With Quote