Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

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: 4,636
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 three examples...
- RunSecureCRTWithAScriptCreatedFromExcelMacro.cls.txt
- RunSecureCRTWithAScriptCreatedFromExcelMacro_JumpHost+Enable.cls.txt
- ConnectToSecondaryHost_via_JumpHost_ShellDriverExcel.bas.txt
...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; 12-08-2020 at 01:27 PM. Reason: Added macro example "ConnectToSecondaryHost_via_JumpHost_ShellDriverExcel.bas.txt"
Closed Thread

Tags
example script

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:33 PM.