Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-03-2019, 04:49 AM
vikram1840 vikram1840 is offline
Registered User
 
Join Date: May 2019
Posts: 13
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 10:36 AM.
Reply With Quote
 

Tags
neid , port


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 10:06 PM.