Cyber Security PowerShell Windows

Clear All Events from Event Logs by Using PowerShell

Written by devendermahto

clean all event logs

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 "$_"}

ClearEventLogsThat’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…

If you want to get a list of all the event logs on your server use this…

It will provide you with a list similar to this…

ClearEventLogs2

Don’t forget to run PowerShell as an administrator.

About the author

devendermahto

Leave a Comment