Results 1 to 4 of 4

Thread: How to Clear the Event Log

  1. #1
    Join Date
    Dec 2008
    Posts
    55

    How to Clear the Event Log

    Hello everyone,

    I Have A Windows System installed With 2 gb Ram , I want to know how to clear the event log, or Can we set it to 1 month. so that it Self- Clean itself After 1 month , Is there any Setting that will allow me do this or any Script File PLease Provide a Way to clear my event logs Thanks in Advance for your responses.

  2. #2
    Join Date
    Nov 2005
    Posts
    1,203

    Re: How to Clear the Event Log

    Clearing the event data for a specific member deletes all of the event data from the Application Center event database for the member. For that reason, you will be unable to view or generate a report for the cluster member from this data. You might want to archive the event data before clearing it.

    To clear the event data from the event log for a specific member

    • In the Application Center snap-in, expand the cluster node, and then expand the Members node.
    • Right-click the member's Events node, and then on the pop-up menu, click Clear events.

  3. #3
    Join Date
    Nov 2005
    Posts
    3,026

    Re: How to Clear the Event Log

    To clear an event log's contents programmatically

    • Create an instance of the EventLog component and set the necessary properties to configure it
    • Use the Clear method to clear the contents of the appropriate event log.


    Your code should look something like this:
    • Visual Basic
      EventLog1.Clear()

    • C#
      EventLog1.Clear();

    • J#
      EventLog1.Clear();

  4. #4
    Join Date
    Apr 2008
    Posts
    3,295

    Re: How to Clear the Event Log

    The following script clears the Security event log after backing it up to a folder mentioned in the script. To run the script, copy the following contents to Notepad, and save the file with .vbs extension. Double-click to run the file.

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate, (Backup, Security)}!\\" _
    & strComputer & "\root\cimv2")
    Set colLogFiles = objWMIService.ExecQuery _
    ("Select * from Win32_NTEventLogFile where LogFileName='Security'")
    For Each objLogfile in colLogFiles
    OutputFile = "C:\" & "Security "
    OutputFile = OutputFile & Day(Now) & "-" & month(now) & "-" & year(now)
    OutputFile = OutputFile & ".evt"
    errBackupLog = objLogFile.BackupEventLog(OutputFile)
    If errBackupLog = 0 Or errBackupLog = 183 Then
    objLogFile.ClearEventLog()
    Else
    Wscript.Echo "The Security event log could not be backed up."
    End If
    Next

Similar Threads

  1. MSI P67A-GD53 (B3) is crashing getting Kernel Power-Event ID 41 in Event viewer
    By Chellappan in forum Motherboard Processor & RAM
    Replies: 7
    Last Post: 10-12-2011, 11:35 AM
  2. Replies: 3
    Last Post: 25-02-2009, 03:42 PM
  3. Event ID: 5721 Event Source: NETLOGON member server windows 2003
    By Edwin Delgado in forum Windows Server Help
    Replies: 1
    Last Post: 08-09-2007, 12:41 AM
  4. Event ID:9791 Event Source: MSExchangeIS Mailbox Store
    By Dakshi in forum Small Business Server
    Replies: 3
    Last Post: 08-05-2007, 05:36 AM
  5. Event Log Error: Event Source:WinMgmt Event ID:10
    By BlackSunReyes in forum Small Business Server
    Replies: 2
    Last Post: 01-03-2007, 03:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,019,694.53640 seconds with 16 queries