Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-04-2008, 01:44 AM
saks saks is offline
Registered User
 
Join Date: Nov 2008
Posts: 2
Create session crt in Vbs script

when I try to log on with securecrt, I have this error message.
This script is part of another script that manages an interface
Should we install a .Dll?
Here my script :
Dim wshell
Set wshell=CreateObject("WScript.Shell")
wshell.Run"SecureCRT.EXE"
Dim objSc,objSe
Set objSc = crt.screen
Set objSe = crt.session
cmd = "/SSH2 /L " & login & " /PASSWORD " & pass & " /C 3DES /M MD5 " & "10.120.0.0"
objSe.connect cmd
objSc.WaitForString "$"
objSc.Send "ssh 10.120.0.0" & VbCr
...

Through a dictionary, i've got the same error

Dim objSc,objSe,objDictionary,A,B
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "A","crt.screen"
objDictionary.Add "B","crt.Session"
Set objSc = objDictionary.Item("A")
Set objSe = objDictionary.Item("B")
objSe.connect cmd
objSc.WaitForString "$"
objSc.Send "ssh 10.120.0.0" & VbCr

Here error : variable not defined : 'crt'

What should be done. Help me
Reply With Quote
  #2  
Old 11-04-2008, 09:19 AM
kbarnette kbarnette is offline
VanDyke Technical Support
 
Join Date: Aug 2007
Posts: 587
Hi saks,

The crt object is not available from outside of SecureCRT.

If you make the following changes to your automation process, you should be able to run the desired script commands:
  1. Change your interface to launch SecureCRT with the /Script argument, as exemplified below:
    SECURECRT.EXE /Script C:\Temp\MyScriptFile.vbs
  2. Remove the following three lines from your current script file, since you will not need to launch SecureCRT with your script:
    Dim wshell
    Set wshell=CreateObject("WScript.Shell")
    wshell.Run"SecureCRT.EXE"

With this type of setup, SecureCRT will be called and told to automatically launch a script, which will execute the connection, WaitForString, and Send commands you need.

Using this information, are you able to modify your current solution to successfully launch SecureCRT and run a script?
Reply With Quote
  #3  
Old 11-05-2008, 07:17 AM
saks saks is offline
Registered User
 
Join Date: Nov 2008
Posts: 2
thank you for your response
That solution I have already done and it works
I wanted to manage crt script in creating functions in my vbs script. if not I will be forced to create as many script beside.
This command call MyScriptFile.vbs can i add an argument to call a function of the script instead of the entire script like MyScriptFile.vbs/function
Reply With Quote
  #4  
Old 11-05-2008, 08:05 AM
kbarnette kbarnette is offline
VanDyke Technical Support
 
Join Date: Aug 2007
Posts: 587
Hi saks,

To accomplish what it is you have described you will probably need to use a command line similar to the following:
SECURECRT.EXE /Script C:\Temp\MyScriptFile.vbs /Arg Function1
You would then need to modify your script to act on the argument(s) passed, and call the appropriate function(s).
I have attached an example script that demonstrates how to handle arguments passed to a SecureCRT script.

Using this information, are you able to accomplish what it is you are looking to do?
Attached Files
File Type: txt ArgumentProccessingExample.vbs.txt (485 Bytes, 588 views)
Reply With Quote
Reply

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 07:52 PM.