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 02-06-2012, 06:02 AM
rusnei rusnei is offline
Registered User
 
Join Date: Feb 2012
Posts: 2
Post Inventory script

Hello,

I need a script that can log on multiple sessions (tab sessions) and read switch/router hostname, model and serial number, and write all info on one CSV text file or Excel workbook.

Any one who can help!
Thank you,

Best regards Neim Rustemi
Reply With Quote
  #2  
Old 02-06-2012, 10:08 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,039
Hello rusnei,

I am not aware of an existing script which does exactly what you describe, however there are many examples in the SecureCRT Scripting Manual that may cover different aspects of what you're wanting to do:
  • 3.3 Open a Group of Sessions in Tabs
  • 4.3 Capturing Data from a Remote Machine
  • 7.3 Save Selected Text to a CSV File
    (the 7.3 example works with selected text,
    rather than text that you parse from the captured data,
    but there may be some overlap in what needs to be done.)
Which version of SecureCRT are you using (Help / About SecureCRT)?

Do you have a series of the same commands that you want to issue on every router?

Do you have anything written for the script already, or are you starting from scratch?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #3  
Old 02-08-2012, 05:40 AM
rusnei rusnei is offline
Registered User
 
Join Date: Feb 2012
Posts: 2
Quote:
Originally Posted by miked View Post
Hello rusnei,

I am not aware of an existing script which does exactly what you describe, however there are many examples in the SecureCRT Scripting Manual that may cover different aspects of what you're wanting to do:
  • 3.3 Open a Group of Sessions in Tabs
  • 4.3 Capturing Data from a Remote Machine
  • 7.3 Save Selected Text to a CSV File
    (the 7.3 example works with selected text,
    rather than text that you parse from the captured data,
    but there may be some overlap in what needs to be done.)
Which version of SecureCRT are you using (Help / About SecureCRT)?
Version 6.7.1 (build 188) - Official Release - June 16, 2011


I think I need a combination of all of these:
[*]3.3 Open a Group of Sessions in Tabs[*]4.3 Capturing Data from a Remote Machine[*]7.3 Save Selected Text to a CSV File


Do you have a series of the same commands that you want to issue on every router?

sh version

and need to capture text on this lines, and export them to CSV file, or maybe Excel file

............
Model number
System serial number

............

Do you have anything written for the script already, or are you starting from scratch?
I'm starting from scratch.
Reply With Quote
  #4  
Old 02-08-2012, 11:00 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,039
A good way to get started is to use the SecureCRT Script Recorder. Unless all of your authentication methods and credentials are the same for each machine, it's probably easier to start the Script Recorder after you're connected to one of the hosts.

In SecureCRT, click the Script menu and select Start Recording Script. Run the commands that you need to run on the server, then select Script / Stop Recording Script and save the file.

Once you have recorded script, review what was recorded. It's going to be a series of crt.Screen.WaitForString and crt.Screen.Send. There's always a WaitForString before a Send. Make sure that the WaitForString is waiting for a string that you'll see on each platform (such as '>', '#', '$'), usually just the last part of the prompt.

Once you have that, you should be able to test the script on one or more of the other routers - connect and then select Script / Run, navigate to the script, see if it sends the commands you want and if you get data back that you'd like to parse. If the recorded script seems to work, you have a pretty good start. What's left is to script the connection to each session (in a tab), reading data from the remote, and saving the data to a file. The sections of the SecureCRT scripting manual mentioned above should help with each of the tasks.
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
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 11:41 PM.