Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #46  
Old 11-19-2014, 04:08 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,015
Hello iabudi,

Todd is not available.

What type of device are you connected to at the time the issue occurs?

What was the command that was sent?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #47  
Old 11-19-2014, 09:30 PM
iabudi iabudi is offline
Registered User
 
Join Date: Oct 2014
Posts: 4
cisco Script

Quote:
Originally Posted by bgagnon View Post
Hello iabudi,

Todd is not available.

What type of device are you connected to at the time the issue occurs?

What was the command that was sent?
I am connecting to cisco router

I sent show ip route and the second command is show log

the script created the file then sent the show ip route (from the command file)
I get back the ip route table and at the end I get the router prompt.
Router#

then it just sits there. until I stop script. and I get the line 399 message.

How can I send you the script?
Reply With Quote
  #48  
Old 11-20-2014, 09:54 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi iabudi,

I am back. Please send the script to support@vandyke.com with a subject of Attn: Todd - Script Problem.

Please include the version of SecureCRT that you are using and ensure that there are no saved passwords in the script.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #49  
Old 02-03-2015, 05:36 PM
symgryph symgryph is offline
Registered User
 
Join Date: Feb 2015
Posts: 2
Unhappy Make script make 1 file per host instead of 1 file per host and command?

I got the version working fine with just doing the 'host' / filename combo, but would like it to just do filename like

hostname.txt

Which contains the complete results of each command in one file as opposed to tons of little files.

I did try modifying the filename output function but just foobard it and couldn't get it to work. Any ideas?

Thomas
Reply With Quote
  #50  
Old 02-03-2015, 06:07 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Thomas,

Thanks for the post.

If you want to have a single host results file rather than files for each command, you would change the line that writes data in the for strCommand in vCommandsList loop to a line that aggregates the results. You would then write out the data after the loop is complete.

In the original Python example, it would be lines 405 to 416 that would aggregate the output.

Lines 417 and 418 would need to be unindented one level, and prior to line 417, you would write out the variable that you used to aggregate the output for all commands run on the host.

You may also want to add some error handling to capture instances where the connection hangs when aggregating the output so you can get out of the loop.

Finally, and maybe firstly, lines 380 to 393 would probably need to be moved out of the loop and just prior to writing out the aggregated log. You may also want to change the file name in the GetSafeFilename() function.

Does this help?

If you need more help, post your script along with what behavior you are seeing, and I can see what might be going wrong.
NOTICE: The requested troubleshooting data may include sensitive information (usernames, passwords, publicly-accessible host names or IP addresses, etc.).

Please redact sensitive information that would not be appropriate for a public forum prior to posting the requested information.

If there is sensitive information that must be conveyed in order to provide a complete picture of the scenario you're facing, please let us know and we will set up a secure upload mechanism that can be used.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #51  
Old 02-05-2015, 04:07 PM
symgryph symgryph is offline
Registered User
 
Join Date: Feb 2015
Posts: 2
Modified script never executes commands

I am using the 'original' script, but it never runs any commands, it just waits there forever.

I am using it on a UNIX system, and have no idea why it doesn't process commands.
Reply With Quote
  #52  
Old 02-05-2015, 05:32 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Thanks for the update Thomas.

To see what might be happening, I would need to see the script. You are welcome to post it or send it to support@vandyke.com with a subject of Attn: Todd - Forum thread #10651.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #53  
Old 03-12-2015, 05:29 PM
vladiny vladiny is offline
Registered User
 
Join Date: Jan 2011
Posts: 6
Hello,

First of all I want to say thank you for writing this most excellent script.

I am using the python script and my version of SecureCRT is Version 7.3.1 (build 685) on my Mac OS X Yosemite. I am only running one command "show running-config" and it works, but the script does not know what to do when it sees " --More--", it is disconnecting from host and going to next host. I would like for it to send the spacebar everytime " --More--" appears until it reaches the "#", then it can disconnect and continue to next host. How can I manipulate the script to make this work? Thanks in advance!
Reply With Quote
  #54  
Old 03-12-2015, 05:58 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi vladiny,

Thanks for the post. I am glad to hear that you find the script example useful.

My suggestion would be to add a command to temporarily disable paging prior to running the show command. Would this work for you?

If not, you would have to modify line 404 to wait for multiple strings and take action based on the different strings that could be found. This would have to be added to a loop and you would have to aggregate the results in a variable.

A VBScript example of how this would be done is found on pages 50 and 51 of the scripting manual. A URL to the manual is at the following location:
https://forums.vandyke.com/showthread.php?t=3634
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #55  
Old 03-12-2015, 10:27 PM
vladiny vladiny is offline
Registered User
 
Join Date: Jan 2011
Posts: 6
Talking

Quote:
Originally Posted by rtb View Post
Hi vladiny,

Thanks for the post. I am glad to hear that you find the script example useful.

My suggestion would be to add a command to temporarily disable paging prior to running the show command. Would this work for you?

If not, you would have to modify line 404 to wait for multiple strings and take action based on the different strings that could be found. This would have to be added to a loop and you would have to aggregate the results in a variable.

A VBScript example of how this would be done is found on pages 50 and 51 of the scripting manual. A URL to the manual is at the following location:
https://forums.vandyke.com/showthread.php?t=3634
Thanks Todd! Made me pull out my old CCNA reference command guide. Just in case someone is looking, that command is "terminal length 0". Add this command first on your Commands.txt file.

I really don't know anything about writing scripts, so modifying that script would have turned out a disaster. Any videos out there that teach you how to write scripts? That would be nice as I am more of a visual person
Reply With Quote
  #56  
Old 03-13-2015, 09:32 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi vladiny,

Thanks for the update and information. I am glad to hear that you found the command you needed for your devices.

I don't know anything about Cisco devices, so this may be of no value, but if that command is not temporary, you may want to add a third command to set paging back to what you expect it to be when manually interacting with a device.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #57  
Old 03-13-2015, 03:26 PM
vladiny vladiny is offline
Registered User
 
Join Date: Jan 2011
Posts: 6
Quote:
Originally Posted by rtb View Post
Hi vladiny,

Thanks for the update and information. I am glad to hear that you found the command you needed for your devices.

I don't know anything about Cisco devices, so this may be of no value, but if that command is not temporary, you may want to add a third command to set paging back to what you expect it to be when manually interacting with a device.
Yes! That command would "terminal Length 24". That is the default.

Todd,

I am running the script and noticing that it is logging each command per host. I only want the script to output all commands per host. Can you show me how to accomplish this? Thanks in advance!
Reply With Quote
  #58  
Old 03-20-2015, 02:22 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi vladiny,

There isn't an easy, error proof way to modify the Python version of this example to accomplish your goal.

We are considering re-writing the Python version to be more similar to the VBScript version, but have no ETA on that.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #59  
Old 04-15-2015, 04:02 PM
Damon Damon is offline
Registered User
 
Join Date: Apr 2015
Posts: 11
For some reason the python version is not working for me but vbscript version does. Also, it it easy to also add to the script so it handles Tacacs. So, after logging in, it issues "enable" and enters the enable password.

I tired adding lines after it send login pawword but it didn't work. I also added "en" and my enable password in "commads.txt" but it wouldn't enter the enable password.
Reply With Quote
  #60  
Old 04-18-2015, 04:34 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi All,

We are working on this issue via email. If we can find out what is wrong in this specific case and environment, I will post here.
__________________
--Todd

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

Tags
example script


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 05:03 PM.