Clearing All Event Viewer Logs

With the advent of Windows Vista and Server 2008, the Event Viewer became the central location for all things related to logging for pretty much everything Windows related. Sometimes, especially when bringing a new system online, you need a bit of clarity. Unfortunately, there’s no easy way to clear all of the logs in a single motion using the UI. A quick bit of batch file kung fu solves this issue for us.

Save the following into a file named something like “ClearLogs.bat”, right-click on it, and “Run As Administrator”. It will clear everything at once. This has been tested and working on Windows Vista, Windows 7, Windows 8, Server 2008, Server 2008 R2, and Server 2012.

@echo off
for /f "tokens=*" %%l in ('wevtutil.exe el') do (call :clearlog "%%l")
echo Clearing %1...
wevtutil.exe cl %1
goto :eof