Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-28-2013, 12:22 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,886
Post Example: Integrating with Microsoft Excel

Example: Excel Spreadsheets - Adding, Copying and Renaming Sheets
This example script demonstrates how to add, rename and copy an Excel worksheet. This script also demonstrates one way to see whether a sheet already exists with the specified name, which is needed because trying to rename a sheet to an existing sheet's name causes an error.


Example: Excel Spreadsheets - Reading and Writing
This example script shows how to read (and write) data from (and to) an Excel spreadsheet using VBScript running within SecureCRT. This specific example connects one by one to hosts (IP address is read in from column "A") and port (read in from column "B") using a connection protocol (read in from column "C") authenticating with user & pass (read in from columns "D" and "E"). The command 'sh config' is run on the host unless the value in column "F" is "No", and then writes the date & time of the activity as well as the results of the command in columns "G" and "H", respectively.


Example: Excel Spreadsheets - Searching and Lookups
Two example scripts (first lookup example, second lookup example) showing how to search for (look up) data within an Excel spreadsheet using VBScript running within SecureCRT, and read data from other cells within the row that contained the data that was found.


Example: Launch SecureCRT from Excel spreadsheet using on-the-fly script
The RunSecureCRTWithAScriptCreatedFromExcelMacro.cls.txt and RunSecureCRTWithAScriptCreatedFromExcelMacro_JumpHost+Enable.cls.txt examples show how, from within an Excel macro, you can gather information from the current row (the active row) and use that info to create an on-the-fly VBScript code file in a temporary location. Once the script file is created, SecureCRT is launched with the /SCRIPT command line option, as well as /ARG elements so that the script SecureCRT is told to run knows a) which protocol to use (Telnet/SSH2/SSH1), b) what hostname to connect to, c) what username to authenticate as and d) what password to use for authentication. Once the SecureCRT instance that was launched has terminated, the temporary script file is deleted.

Pic of spreadsheet for RunSecureCRTWithAScriptCreatedFromExcelMacro.cls.txt example:

Pic of spreadsheet for RunSecureCRTWithAScriptCreatedFromExcelMacro_JumpHost+Enable.cls.txt example:

--Jake

Last edited by jdev; 03-02-2018 at 04:59 PM. Reason: Added Excel Macro examples that launch SecureCRT from within Excel
Closed Thread

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 07:05 AM.