cancel
Showing results for 
Search instead for 
Did you mean: 

General Discussions

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.

0 Likes
4 Replies

.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-3600c16dgtzn kit, Aorus gen4 1tb, Nitro+RX6900XT, RM850, Win.10 Pro., LC27G55T..
0 Likes

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

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-3600c16dgtzn kit, Aorus gen4 1tb, Nitro+RX6900XT, RM850, Win.10 Pro., LC27G55T..
0 Likes

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