Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-27-2014, 09:52 AM
GJB56 GJB56 is offline
Registered User
 
Join Date: Nov 2011
Posts: 22
Disable default session logging

I have a script that connects to multiple devices where the script controls the logfile name. If CRT (v7.2.3) has the default session set to start logging when connected, I get 2 logfiles, the default session and the one created by the script. I can manually change the default settings not to log and everything works as desired. The downside is someone might forget to manually re-enable. My question; is there a way to disable/enable the default session via the script?
Reply With Quote
  #2  
Old 05-27-2014, 12:20 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,295
Hello GJB56,

Quote:
I have a script that connects to multiple devices where the script controls the logfile name. If CRT (v7.2.3) has the default session set to start logging when connected, I get 2 logfiles, the default session and the one created by the script. I can manually change the default settings not to log and everything works as desired. The downside is someone might forget to manually re-enable. My question; is there a way to disable/enable the default session via the script?
What do you mean by the one created by the script?

Are you launching SecureCRT from the command-line with a /SCRIPT argument?

How is the connection made?

If you are making an ad hoc connection either via command-line or in the script, then the Default Session configuration is used.

One alternative would be to connect via an existing saved session (assuming logging is not configured in the session) and SecureCRT would use that configuration instead of the Default Session.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-27-2014, 04:02 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,295
Hi GJB56,

After discussion with colleagues, we came up with the following possible scenario. We made a few assumptions regarding how logging might be configured via Default Session.

Essentially, somewhere in your script before you connect you would disable Default Session logging:

Code:
Set objDefCon = crt.OpenSessionConfiguration("Default")
g_bStart = objDefCon.GetOption("Start Log Upon Connect")
g_strLogFileName = objDefCon.GetOption("Log Filename V2")
objDefCon.SetOption "Start Log Upon Connect", False
objDefCon.SetOption "Log Filename V2", ""
objDefCon.Save
Then, connect, do whatever is needed regarding logging within the script, then at the end, undo what you have done above to restore the original Default Session logging configuration:

Code:
Set objDefCon = crt.OpenSessionConfiguration("Default")
objDefCon.SetOption "Start Log Upon Connect", True
objDefCon.SetOption "Log Filename V2", g_strLogFileName
objDefCon.Save
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #4  
Old 06-02-2014, 03:54 AM
GJB56 GJB56 is offline
Registered User
 
Join Date: Nov 2011
Posts: 22
Thank you. This is exactly what I was looking for and it works great. One minor adjustment in retoring settings:

objDefCon.SetOption "Start Log Upon Connect", True
should be
objDefCon.SetOption "Start Log Upon Connect", g_bStart
Reply With Quote
Reply


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 01:26 AM.