Tag Archives: Windows event log
Windows logs a lot of information in the event logs to make it easier for users to troubleshoot potential problems with their system.
Each event log category has a default limit of 1028 kilobytes. Because of that it is possible for a category to store a few thousand entries dating back a few years. In my case I had entries that were older than 5 years. Obviously this might make it a bit harder to go through the logs, especially if you want to view the logs that were created after you made some particular change to the system which you want to verify that it did not cause any issues.
Sadly, there isn’t a default option to clear all the event logs at the same time and clearing up one category at a time is very time consuming due to the number of categories that are available. Luckily we can create a .bat file to do the work for us.
Open up your favourite text editor, insert the snippet below and save it with the extension
.bat. You can give it any name you want. Then simply run the file as administrator and it will clear up all event log entries for you automatically.
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
echo goto theEnd
echo clearing %1
wevtutil.exe cl %1