View Single Post
Old 12-11-2019, 04:57 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 990
Post Example: Iterate Over Saved Sessions

These example scripts demonstrate how to iterate over saved sessions in SecureCRT's configuration folder's Sessions subfolder.

There isn't yet a native scripting API provided by SecureCRT for accessing saved sessions (say, from the Session Manager), so the way to go about this is to iterate over the .ini files in the Sessions subfolder of SecureCRT's configuration folder, and use the full file system path information to build up a session manager path (as it appears in the Session Manager) so that you can load the configuration using the crt.OpenSessionConfiguration(strSessionMgrPath) method to get a reference to the Config object for a specified session.

These two iteration examples demonstrate not only how to iterate over all saved sessions (ignoring the Default.ini and the informational __FolderData__.ini files) but also how to export saved session data to CSV file or conf/INI file format.

Script: IterateOverAllSessionsRecursively_CSVOutputFormat.vbs.txt
Script: IterateOverAllSessionsRecursively_ConfFileOutputFormat.vbs.txt

EDIT: (4/22/2020) Here's a python example that iterates over saved sessions, changing the host name.

Script (Python example):

Jake Devenport
VanDyke Software
Technical Support
YouTube Channel:

Last edited by jdev; 04-22-2020 at 01:44 PM.