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 03-23-2018, 10:18 AM
dlong dlong is offline
Registered User
 
Join Date: Dec 2015
Posts: 15
Script for Logfile Overwrites Session Properties

Wondering how to specify a logfile location within a VBS script, but to not have the default logfile location changed after running the script.
Reply With Quote
  #2  
Old 03-23-2018, 10:39 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,049
Hi dlong,

I am not sure what you mean. Please provide specifics as to the behavior that is happening vs the desired behavior.

Are you using the LogUsingSessionOptions method (and LogFileName property)?

If you want to use a location other than what is saved in a session or Default Session, you might capture the original into a variable that you can restore at the end of your script.

Or use other mechanisms for log file creation (such as VBScript's OpenTextFile() function available when using a FileSystemObject). This way of logging is illustrated in the RunCommandsOnMultipleHostsAndLogResults example script here.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 03-23-2018, 11:09 AM
dlong dlong is offline
Registered User
 
Join Date: Dec 2015
Posts: 15
Hi Brenda,

I am using the crt.Session.LogFileName property to specify a log location, and I try to reset the logfile location at the end, but all subsequent sessions use the "LD117" file structure.


logfile = "C:\files\secureCRT\MyLocation\LD_117_ERL_" & strYear & "-" & strMonth & "-" & strDay & "_" & strHour & strMin & StrSec & ".txt"
crt.Session.LogFileName = logfile

' Enable logging
crt.Session.Log True

(stuff gets captured)

crt.Session.Log False
logfile = "C:\files\secureCRT\MyLocation\%Y-%M-%D_%h-%m-%s.txt"

UPDATE: My bad. I was not adding in the command to set the logfile at the end: crt.Session.LogFileName = logfile

Last edited by dlong; 03-23-2018 at 11:12 AM.
Reply With Quote
  #4  
Old 03-23-2018, 11:20 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,049
Hi dlong,

You beat me to it. I am glad to hear you were able to resolve the issue. Thanks for posting the update. Have a great weekend!
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 03-23-2018, 11:32 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,049
Hi dlong,

Our scripting guru suggested the method illustrated in the attached script.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
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 09:07 PM.