Showing posts with label clear. Show all posts
Showing posts with label clear. Show all posts

Tuesday, October 18, 2011

Clearing All Logs

I've had the need to clear log files on multiple Windows Server 2008 R2 testing machines - more specifically virtual machines - and there was no easy way I could find to do this task. I wasn't going to open every log file in Event Viewer. I'd rather let a for loop do that for me, or a drinking bird.

Wrote a song about it. Like to hear it? Here it goes!

via Command-Line (Run as Administrator)

for /f %e IN ('wevtutil el') do wevtutil cl "%e"


or via batch file (.cmd or .bat)


@echo off
:: Clear all logs
::  10:55 AM 10/18/2011 Justin
::   http://justin-bennett-msjc.blogspot.com/
::
::
echo Clearing all log files
echo CRTL-C to abort within 10 secs.
echo .
ping 127.0.0.1 -n 11 > nul
color 07
@echo on
for /f %%e IN ('wevtutil el') do wevtutil cl "%%e"



Image From King-Size Homer - Simpsons Wiki, http://simpsons.wikia.com/wiki/King-Size_Homer