RE: EIF Logging to a new trace file everyday

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Mike Hayton [MS] (mikehayt__at_online.microsoft.com)
Date: 08/19/04


Date: Thu, 19 Aug 2004 16:43:56 GMT

You might want to run the following script to roll over the log files.

Using the windows AT command you could schedule the script to run every day

Cheers
Mike

================================
wscript.echo "Script started ..."

dtNow = Now
sNow = Year(dtNow) & Right("0" & Month(dtNow),2) & Right("0" &
Day(dtNow),2) & "T" & Right("0" & Hour(dtNow),2) & Right("0" &
Minute(dtNow),2) & Right("0" & Second(dtNow),2)

Set traceSettings =
CreateObject("Microsoft.EnterpriseInstrumentation.Configuration.TraceSetting
s")

strTraceConfigFile = traceSettings.GetConfigFileLocation()
traceSettings.load(strTraceConfigFile)

Set colTraceSessions = traceSettings.TraceSessions

For Each traceSession In colTraceSessions

        wscript.echo "Trace Session Name: " & traceSession.Name
        wscript.echo "Trace Session Log Name: " & traceSession.FileName
        wscript.echo "Trace Session Status: " & traceSession.Enabled

        If traceSession.Enabled Then
                path = Left( traceSession.FileName, InStrRev( traceSession.FileName, "\"
) )
                traceSession.FileName = path & traceSession.Name & "_" & sNow & ".log"
                wscript.echo "New Trace Session Log Name: " & traceSession.FileName
        End If

Next
 
'Since the trace session.config file has been changed we need to save it
   
If traceSettings.IsDirty Then
        wscript.echo "Saving configuration changes"
        traceSettings.Save
End If

wscript.echo "Script terminated."

--------------------
|
| All:
My application logs messages to windows trace file. It is writing to the
file TraceLog.Log and the trace session settings are default.

Everything is working fine but I would like to write to a new file everyday
instead of writing to the same TraceLog.Log.
Currently it is taking the backup of the file TraceLog.Log but I have no
idea when and how it is taking the backup.

Any one please help

Thanks

|
| ---
| Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
|

-- 
This posting is provided "AS IS" with no warranties, and confers no rights. 
Use of included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm 


Relevant Pages

  • Re: Microsoft Warns of New Windows Flaw (March 19, 2003 )
    ... In WINDOWS SETUP in ADD/REMOVE PROGRAMS of Control Panel ... Uninstall Outlook Express, ... Java, Javascript, ActiveX and all the other script runner toys Billy ... Install WebWasher the spammers are terrified of free from ...
    (comp.security.misc)
  • Re: Microsoft Warns of New Windows Flaw (March 19, 2003 )
    ... In WINDOWS SETUP in ADD/REMOVE PROGRAMS of Control Panel ... Uninstall Outlook Express, ... Java, Javascript, ActiveX and all the other script runner toys Billy ... Install WebWasher the spammers are terrified of free from ...
    (comp.security.firewalls)
  • [NT] Flaw in Windows Script Engine Could Allow Code Execution
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... The Windows Script Engine provides Windows operating systems with the ... blocked by Outlook Express 6.0 and Outlook 2002 in their default ...
    (Securiteam)
  • Re: Right click on text vs. right click on hyperlink
    ... I were to do that the built-in Windows way, I have to go down about ... >> me to open in one step the editing page of any archive page in my ... >> contains the below Windows script. ... >> that url and opens the editing page. ...
    (microsoft.public.scripting.vbscript)
  • Re: Turing of SP2 Firewall via registry entry?
    ... Group Policy that disables the firewall (see WF_XPSP2.doc ... Disabling the Use of Windows Firewall Across Your Network ... you create a script file that is read by ...
    (microsoft.public.windowsxp.security_admin)