Nov 24, 2009

How To Delete Event Logs

I had this requirement of deleting event log once. Now I wonder why there is no delete log option when we are viewing the event log using windows event log viewer.
One alternative was to create a small utility in .NET and run it which deletes the particular event log. It worked but was time consuming. Then I came across this cool stuff which you do with powershell! Just one line and you can delete event log!

Just open powershell and type in the following. Caution! it will not ask for confirmation and will immediately delete event log.

[system.diagnostics.eventlog]::Delete("YourEventLogNameHere")
I tested it with windows powershell v1.0

No comments:

Post a Comment