cancel
Showing results for 
Search instead for 
Did you mean: 

General Discussions

elstaci
MVP

FYI: How to delete all Event Viewer logs using Powershell command

Up to now I have been using a Batch file that someone created for Windows 7, in the past, to clear all Windows 10 Event Viewer logs at one time. But now found the following Powershell command that does the same function.

The Powershell Command is: (just copy and paste to Powershell)

wevtutil el | Foreach-Object {wevtutil cl “$_”}

This clears all the logs in Event Viewer.

I sometimes like to clear all the logs of Event Viewer after troubleshooting Windows for Event Viewer type errors. This allows me to see clearly all the errors that occurs after applying the fix to whatever problem I had instead of seeing a huge amount of past errors.

EDIT: goodplay​ found a Forum where you can download a .BAT file to delete all the Event Viewer logs. The link is in his comment.

But if you don't feel comfortable using a .bat file then use the above Powershell command which is the safest way of deleting all Event Viewer logs at one time.

Tags (1)
0 Likes
4 Replies
goodplay
MVP

Re: FYI: How to delete all Event Viewer logs using Powershell command

.bat for Win10

https://www.tenforums.com/tutorials/16588-clear-all-event-logs-event-viewer-windows.html

Ryzen 5 5600x, B550 aorus pro ac, Hyper 212 black, 2 x 16gb F4-3200c16d kit, Aorus nvme gen4 1tb, Nitro+RX6900XT, RM850.
0 Likes
elstaci
MVP

Re: FYI: How to delete all Event Viewer logs using Powershell command

I was trying to find out where I downloaded the .BAT file from. But it was so long ago that I forgot. I do believe it was from SevenForum at the time where I was able to download it from.

The .BAT file is a little bit easier to use since all you have to do is click on it to run it. While in Powershell you need to do more than one click to clean out Event Viewer logs.

Thanks for finding where to download the .BAT File for those who are interested.

I converted my .BAT file into a .EXE file so that I can automatically run it in a elevated mode under "Properties' while as a .BAT you need to create a Task schedule to run it in elevated mode.

0 Likes
goodplay
MVP

Re: FYI: How to delete all Event Viewer logs using Powershell command

Yes there is one from sevenforums.com(it also worked on win8).

Ryzen 5 5600x, B550 aorus pro ac, Hyper 212 black, 2 x 16gb F4-3200c16d kit, Aorus nvme gen4 1tb, Nitro+RX6900XT, RM850.
0 Likes
elstaci
MVP

Re: FYI: How to delete all Event Viewer logs using Powershell command

This the same .Bat that I downloaded and have been using since Windows 7. It works on Windows 10 - latest version - since I have been using it on my Windows 10 OS.

But as I mentioned earlier, I needed to convert the .BAT into .EXE so I can make it run with ADMIN RIGHTS under "Properties".  With a .BAT file you need to open a TASK to run it under ADMIN RIGHTS.

0 Likes