How to Clear Server Event Logs using Task Scheduler

I sometimes run into a problem with the event logs filling up.  There are options to overwrite but I find a quicker and neater method to just put this above in a .vbs file and schedule via Task Scheduler

I sometimes run into a problem with the event logs filling up.  There are options to overwrite but I find a quicker and neater method to just blow them all away by putting this in a .vbs file and schedule via Task Mgr. The following obviously assumes a 32-bit OS, so change it up as needed:

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

Submit a comment

CommentLuv badge

reverse phone lookupTattoo DesignsSEO
My New Amazon Script Is Close!
A new php script for sale is coming!
Sign up to get notified

..