Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2017, 07:00 AM
z_haseeb z_haseeb is offline
Registered User
 
Join Date: Feb 2017
Posts: 3
How to run multiple commands via cmd

ENVIRONMENT

SecureCRT is installed = windows10
Remote machines = RHEL 5x and 6x

I am using below commands to login on a remote machine. My query is, how can we add commands like date or ls -l

"SecureCRT 8.1.lnk" ssh2://admin:*Passw0rd*@10.10.20.1
Reply With Quote
  #2  
Old 02-03-2017, 12:01 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,526
Hi z_haseeb,

If you are launching SecureCRT via command-line/shortcut, I would suggest using the session command-line argument and then in that session configure Logon Actions (Connection / Logon Actions category of Session Options).

Path_to_SecureCRT.exe /S My10.10.20.1_Session

In the Logon Actions category, enable Automate logon, change the Expect/Send sequences appropriately to authenticate and then send the desired commands.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 02-05-2017, 11:15 PM
z_haseeb z_haseeb is offline
Registered User
 
Join Date: Feb 2017
Posts: 3
Hello bgagnon

1- Thanks for your response. I did the below steps as per your recommendation.

- Save a session with a name Mysession.
- I am able to connect successfully with my HUAWEI firewall via windows machine with this command Path_to_SecureCRT.exe /S Mysession
- However when I add a remote command(s) under Mysession > Properties > Connection > Login Actions > Remote Commands, I am unsuccessful. Below is the message for your reference:

HU-FW]
Note: The max number of VTY users is 5, and the current number
of VTY users on line is 0.
Reply With Quote
  #4  
Old 02-06-2017, 08:56 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,526
Hi z_haseeb,

For running the commands, I was expecting you would use the Expect/Send sequences in the Logon Actions category, not Remote Command.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 02-07-2017, 05:48 AM
z_haseeb z_haseeb is offline
Registered User
 
Join Date: Feb 2017
Posts: 3
My problem is resolved. I did the following.

1- Make a session > Properties of session > specify session name and select protocol SSH2.
2- Properties of session > login session > under expect we write the name of prompt like USER~> and under send we mentioned command name like date or time or ls

2- Open windows CMD and run this command "SecureCRT 8.1.lnk" /S 10.10.20.1

3- Successfully reached on right prompt.

HELPFUL LINKS
https://my.oschina.net/leejun2005/blog/593675
http://blog.csdn.net/anonymalias/art...tails/41897969


(Can we use the expect & send options via windows command line ?...for example SecureCRT /S 10.10.10.10 expect xxxx send xxxx)

Last edited by z_haseeb; 02-07-2017 at 06:53 AM.
Reply With Quote
  #6  
Old 02-07-2017, 08:41 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,526
Hi z_haseeb,

I am glad to hear the issue is resolved.

Quote:
(Can we use the expect & send options via windows command line ?...for example SecureCRT /S 10.10.10.10 expect xxxx send xxxx)
No, that's not presently possible, but as one of the links you posted illustrates, you can perform the same via a script. I cannot read most of it, but it seems to illustrate various ways to automate SecureCRT.

Then your command-line might be:

SecureCRT /Script "Path_to_MyScript.vbs" /S 10.10.10.10

An expect would be a WaitForString() method and a send also the Send() method available to the Screen Object. All the objects, methods and properties available are documented in SecureCRT's Help topic Scripting / Script Objects Reference. If on Windows/using VBScript, you might also find the scripting manual here useful.

Since I thought it might be useful for you, I have added this thread to a feature request in our product enhancement database to add a way to export Expect/Send sequences to a script. Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to support@vandyke.com and include "Feature Request - Forum Thread #12597" in the subject line or use this form from the support page of our website.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


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

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 08:44 AM.