I had a situation where I needed to clear all of the event logs on a Windows System. I launched the event viewer and was going to manually clear each of the logs.
Yikes! There are 394 event logs on my server. No way am I going to do this manually. This is a job for PowerShell.
To clear all of the event logs, run PowerShell as an administrator and type in the following command text…
wevtutil el | Foreach-Object {wevtutil cl "$_"}
That’s it. Remember that this command will clear ALL event logs. If you want to clear an individual log (Application log for example) use this…
1
|
wevtutil cl application
|
If you want to get a list of all the event logs on your server use this…
1
|
wevtutil el
|
It will provide you with a list similar to this…
Don’t forget to run PowerShell as an administrator.