Windows Vista Forums

Clear all logs in 2008 R2
  1. #1


    boe Guest

    Clear all logs in 2008 R2

    Hello,

    I'd like to know an easy way to clear all logs in 2008 R2 - not just the
    application logs or DNS logs or DFS logs but ALL logs at the same time
    (without reformatting the server )




      My System SpecsSystem Spec

  2. #2


    Meinolf Weber [MVP-DS] Guest

    Re: Clear all logs in 2008 R2

    Hello boe,

    You can run a script that searches for .log for example and delete then all
    of them. B U T sometimes logfiles are used when a program is started or accessed,
    so i wouldn't do this.

    What is the reason for deleting all logfiles?

    Best regards

    Meinolf Weber
    Disclaimer: This posting is provided "AS IS" with no warranties, and confers
    no rights.
    ** Please do NOT email, only reply to Newsgroups
    ** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm


    > Hello,
    >
    > I'd like to know an easy way to clear all logs in 2008 R2 - not just
    > the application logs or DNS logs or DFS logs but ALL logs at the same
    > time (without reformatting the server )
    >


      My System SpecsSystem Spec

  3. #3


    Dave Patrick Guest

    Re: Clear all logs in 2008 R2

    You can probably script it.

    http://technet.microsoft.com/en-us/l.../ee176696.aspx


    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "boe" wrote:

    > Hello,
    >
    > I'd like to know an easy way to clear all logs in 2008 R2 - not just the
    > application logs or DNS logs or DFS logs but ALL logs at the same time
    > (without reformatting the server )
    >

      My System SpecsSystem Spec

  4. #4


    boe Guest

    Re: Clear all logs in 2008 R2

    Hopefully someone will sell the script or post it as a freeware fix.

    "Dave Patrick" <DSPatrick@newsgroup> wrote in message
    news:O7xRzdczKHA.928@newsgroup

    > You can probably script it.
    >
    > http://technet.microsoft.com/en-us/l.../ee176696.aspx
    >
    >
    > --
    >
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    > "boe" wrote:

    >> Hello,
    >>
    >> I'd like to know an easy way to clear all logs in 2008 R2 - not just the
    >> application logs or DNS logs or DFS logs but ALL logs at the same time
    >> (without reformatting the server )

      My System SpecsSystem Spec

  5. #5


    Dave Patrick Guest

    Re: Clear all logs in 2008 R2

    I'm sure there are many of them out there. Here's one.

    http://msdn.microsoft.com/en-us/libr...93(VS.85).aspx



    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "boe"wrote:

    > Hopefully someone will sell the script or post it as a freeware fix.

      My System SpecsSystem Spec

  6. #6


    boe Guest

    Re: Clear all logs in 2008 R2

    THanks - you think this clears ALL logs?


    Use the Win32_NTEventlogFile class and the ClearEventLog method.
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,(Backup)}!\\" & _
    strComputer & "\root\cimv2")
    Set colLogFiles = objWMIService.ExecQuery _
    ("Select * from Win32_NTEventLogFile " _
    & "Where LogFileName='Application'")
    For Each objLogfile in colLogFiles
    objLogFile.ClearEventLog()
    WScript.Echo "Cleared application event log file"
    Next

    "Dave Patrick" <DSPatrick@newsgroup> wrote in message
    news:uZEF4$nzKHA.244@newsgroup

    > I'm sure there are many of them out there. Here's one.
    >
    > http://msdn.microsoft.com/en-us/libr...93(VS.85).aspx
    >
    >
    >
    > --
    >
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    > "boe"wrote:

    >> Hopefully someone will sell the script or post it as a freeware fix.

      My System SpecsSystem Spec

  7. #7


    boe Guest

    Re: Clear all logs in 2008 R2

    I tried to run it on a test system as admin and got - clearlog.vbs(10, 5)
    SWbemObjectEx: Access denied

    "boe" <boe_d@newsgroup> wrote in message
    news:O9c2NSozKHA.6112@newsgroup

    > THanks - you think this clears ALL logs?
    >
    >
    > Use the Win32_NTEventlogFile class and the ClearEventLog method.
    > strComputer = "."
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate,(Backup)}!\\" & _
    > strComputer & "\root\cimv2")
    > Set colLogFiles = objWMIService.ExecQuery _
    > ("Select * from Win32_NTEventLogFile " _
    > & "Where LogFileName='Application'")
    > For Each objLogfile in colLogFiles
    > objLogFile.ClearEventLog()
    > WScript.Echo "Cleared application event log file"
    > Next
    >
    > "Dave Patrick" <DSPatrick@newsgroup> wrote in message
    > news:uZEF4$nzKHA.244@newsgroup

    >> I'm sure there are many of them out there. Here's one.
    >>
    >> http://msdn.microsoft.com/en-us/libr...93(VS.85).aspx
    >>
    >>
    >>
    >> --
    >>
    >> Regards,
    >>
    >> Dave Patrick ....Please no email replies - reply in newsgroup.
    >> Microsoft Certified Professional
    >> Microsoft MVP [Windows]
    >> http://www.microsoft.com/protect
    >>
    >> "boe"wrote:

    >>> Hopefully someone will sell the script or post it as a freeware fix.
    >

      My System SpecsSystem Spec

  8. #8


    Dave Patrick Guest

    Re: Clear all logs in 2008 R2

    No, only the application event log. You'll need to modify or expand
    functionality to fit your needs.


    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "boe" wrote:

    > THanks - you think this clears ALL logs?
    >
    >
    > Use the Win32_NTEventlogFile class and the ClearEventLog method.
    > strComputer = "."
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate,(Backup)}!\\" & _
    > strComputer & "\root\cimv2")
    > Set colLogFiles = objWMIService.ExecQuery _
    > ("Select * from Win32_NTEventLogFile " _
    > & "Where LogFileName='Application'")
    > For Each objLogfile in colLogFiles
    > objLogFile.ClearEventLog()
    > WScript.Echo "Cleared application event log file"
    > Next

      My System SpecsSystem Spec

  9. #9


    Dave Patrick Guest

    Re: Clear all logs in 2008 R2

    Actually for vista / 2008 / 7 you'll probably want to use Wevtutil tool.

    http://technet.microsoft.com/en-us/l...48(WS.10).aspx



    --

    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "boe" wrote:

    >I tried to run it on a test system as admin and got - clearlog.vbs(10, 5)
    > SWbemObjectEx: Access denied

      My System SpecsSystem Spec

  10. #10


    boe Guest

    Re: Clear all logs in 2008 R2

    Thanks - I got it working but it only clears the application log - which you
    can right click and clear. I'd like a script that clears every sling log,
    including anything found in the administrative events without having to
    write the code to clear every log by name as that could take me a very very
    very long time.

    "Dave Patrick" <DSPatrick@newsgroup> wrote in message
    news:uZEF4$nzKHA.244@newsgroup

    > I'm sure there are many of them out there. Here's one.
    >
    > http://msdn.microsoft.com/en-us/libr...93(VS.85).aspx
    >
    >
    >
    > --
    >
    > Regards,
    >
    > Dave Patrick ....Please no email replies - reply in newsgroup.
    > Microsoft Certified Professional
    > Microsoft MVP [Windows]
    > http://www.microsoft.com/protect
    >
    > "boe"wrote:

    >> Hopefully someone will sell the script or post it as a freeware fix.

      My System SpecsSystem Spec

Clear all logs in 2008 R2 problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with CBS.logs angelicmind Vista file management 6 05 Jun 2009
VS 2008 update causes VS2005 to no longer clear undo history on document close PJ6 .NET General 1 16 Jan 2009
CBS.Logs silver hair Vista General 2 20 Jul 2008
subject windows Vista Event Logs access through WMI ( Applications and Services Logs) beeess Vista networking & sharing 0 17 Apr 2007
windows Vista Event Logs access through WMI ( Applications and Services Logs) beeess Vista General 0 17 Apr 2007