VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Continuous delivery of SecureCRT session file (

lionelrichie 07-22-2019 05:33 PM

Continuous delivery of SecureCRT session file
I want to be able to continuously compile our CSV of devices into a SecureCRT session file format that users can check out of git. Every time someone updates our CSV of devices, I would like a new SecureCRT session file generated. Our CI/CD process can take care of that, assuming I can offer automation for the SecureCRT side. These users will be primarily Windows 10 users. The host I want to do this continuous delivery (read: conversion) on is a Linux box with no GUI.

There is lots of discussion on the forums and web about the VBS and Python scripts reading in CSVs but they depend on an interactive client experience to import the sessions given a data file(CSV).

Some questions:

a) Should I be installing the Linux client package on the Linux host doing the continuous conversion in order to have access to the libraries needed? Are they available through pip? How do I include them in a Python script on that host?

b) What methods am I using to generate that session file, and what format is it producing (ini?)


jjh 07-23-2019 10:50 AM

Hello lionelrichie.

Thank you for contacting us. As you have alluded to, there isn't a mechanism that is built into SecureCRT to generate sessions based on a csv file. We offer a Python version and a VBScript version of a script that can generate SecureCRT sessions based on a csv file, which you can find on the following page on our forums:


We offer a video on our YouTube channel that explains how to use the script, which you can find on the following web page:


You will need to run the script from SecureCRT, which is a manual process, so if you choose to use the script, you will need to install SecureCRT on the machine where the sessions are to be generated. What it does is generate the .ini files that SecureCRT uses as sessions. The .ini files that are generated from the csv file are stored in a folder named "Sessions", that is found within the user's Config folder.

Since you are looking for a way to automate this process, it will be up to you to decide how you are going to do it. It sounds like you will need to find a way to monitor the .csv file for updates. Then, once the file has been updated, if you find a way to trigger something to happen, the event that happens could be launching SecureCRT with the /script flag so that the session generation script can run.

Also, the script generates all of the sessions from the .csv file each time it is run, but it will use a timestamp if duplicate sessions are created. You will have to take this into account so that you can decide whether or not it will make sense to generate all of the sessions every time the script is run.

Perhaps, every time you wanted to add new hosts, instead of adding them to an existing .csv file, you could create a new file and run the script against it. That way you wouldn't have to worry about how to deal with duplicates.

If you would like me to create an entry for you in our feature request database for a built in way to generate sessions based on a csv file, please send e-mail to referencing this forum thread so that I can include your e-mail address in the request.



lionelrichie 07-23-2019 05:28 PM

Thanks - this is helpful. Here is another consideration I could use your feedback on: when someone consumes a future version of the address book / session ini, how do we allow them to merge changes so they don't lose their customizations? Example: I add two hosts to this csv->ini compilation process on my Linux builder, it spits out a new ini, someone grabs that ini - so what happens to customizations they have made to sessions already imported? I am thinking about things like username and password.

This might be asking more of the tool than is currently available but I am probing to see what is possible, and whether this is worth the effort.

ogun 07-24-2019 07:02 AM

We do basically what you are asking for at our place. I wrote a python script that takes JSON data files and generates sessions accordingly.

It was posted on the forum previously

When it runs, it creates a diff of existing sessions and new sessions. It will then create all the new sessions and ask if it should delete sessions no longer in the data file.
It will not touch already existing sessions based on the session name as the key, if you want to generate them again you'd have to delete the session and then run the script.
When it creates a session it copies the default session, sets the parameters and then saves it as a new session.

Feel free to use as inspiration or as is, I'll be happy to answer any questions as well.

jjh 07-24-2019 10:45 AM

Each user has a Config folder that stores their settings. Inside the Config folder are various folders and files including the Global.ini file, which stores you global settings and a folder named "Sessions", which stores the .ini files associated with your sessions.

We offer an export/import tool under the Tools menu in SecureCRT. You have the option of exporting and importing any combination of your Global Options, Sessions, License and Scheduled Tasks (If you are using the Windows version). When you use the export tool, SecureCRT will create an xml file containing all of the information you choose to export. When you use the import tool, you need to specify that xml file. Duplicates will be ignored. So files with the same name on both machines will be omitted. If you have a session named "Session1" on the machine that is doing the export and the machine doing the import also has a session named "Session1", that session will not be imported. It is important to know that if you are using a Configuration Passphrase when you use the export tool, you will need to provide that configuration passphrase when you do the import.

Another thing to be aware of is that there is a setting in the Configuration Paths category of your Global Options labeled "Store personal data separately". If you enable that setting, SecureCRT will remove your saved credentials from your sessions and store them in a separate folder. That setting will make it possible for you to share your sessions without sharing your credentials.

If you don't want to use the Export and Import tools, you can simply make any new .ini files available for sharing and instruct your users to copy them into their "Sessions" folder. Once the end user owns their own copy of the session.ini files, they can save their own passwords or customize the sessions in whatever way they want.


All times are GMT -6. The time now is 12:07 AM.