Batch file to clear the event viewer file

  • Thread starter Thread starter Patrick Bonneau
  • Start date Start date
P

Patrick Bonneau

Is there a way to make a batch file to clear the event
viewer each monday at 18:00.
Now I use dumpel to log all the event that I want.

Thanx a lot!
 
Patrick Bonneau said:
Is there a way to make a batch file to clear the event
viewer each monday at 18:00.
Now I use dumpel to log all the event that I want.


Here is a VBScript file that can be run using the scheduler:

------
strComputer = "."
Set oWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")
Set cLogFiles = oWMIService.ExecQuery _
("SELECT * FROM Win32_NTEventLogFile")
For Each oLogfile in cLogFiles
oLogFile.ClearEventLog()
Next
-------------

--
Matt Hickman
congratulations and welcome to the the ranks of free men.
I've been free a parcel of years now and I predict that you
will find it looser but not always more comfortable.
- Robert A. Heinlein _Citizen of the Galaxy_
 
Back
Top