Deleting Windows 7 Event Logs [Archive] - Glock Talk

PDA

View Full Version : Deleting Windows 7 Event Logs


ArtCrafter
09-13-2011, 23:14
I was looking for a way to do this and found a pretty good discussion on it over in the Windows 7 forum on CNET:

http://forums.cnet.com/7723-19411_102-378338.html

I am now using the batch program by dexxus shown in the next to last post, and it seems to do the job.

In particular, it took out a corrupted Media Center log file that was giving me no end of grief. (I have since shut off the Media Center service since I don't use it.)

HTH :wavey:

racer11
09-18-2011, 21:50
Just curious and wanting to know..........

What is a event log and why would I ever want to clear it out

ArtCrafter
09-19-2011, 06:53
Just curious and wanting to know..........

What is a event log and why would I ever want to clear it out

Event Logs: http://technet.microsoft.com/en-us/library/cc938674.aspx

Basically, these logs record system 'events' (such as 'logs cleared'...lol).

As for why, you don't 'need' to clear them. Some say you shouldn't. Others view it as 'good housekeeping.' Still others see it as yet another 'privacy' issue (although it's not clear to me why).

Mainly, I just like to keep my machine 'clean.' :)




PS: I've switched to a more 'polished' wevtutil-based cleaning/clearing code: (Ref.) (http://www.sevenforums.com/performance-maintenance/173642-polished-event-log-cleaning-script.html)

@echo off
TITLE Eventing Command Line Utility: Cleanup Script
goto :question

:question
echo.
echo EMPTY ALL WINDOWS AND PROGRAM EVENT LOGS?
echo.
SET /P ANSWER=(YES/NO):
if /i {"%ANSWER%"}=={"y"} (goto :start)
if /i {"%ANSWER%"}=={"yes"} (goto :start)
if /i {"%ANSWER%"}=={"n"} (goto :cancel)
if /i {"%ANSWER%"}=={"no"} (goto :cancel)
goto :input_error

:input_error
cls
echo.
echo *ERROR: Invalid Option
echo _________________________________________
goto :question

:start
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :clear "%%G")
goto :finish

:clear
echo Emptying %1
wevtutil.exe cl %1
goto :eof

:finish
cls
echo.
wevtutil.exe cl System
echo.
echo DONE. Press any key to exit.
pause>NUL
goto :eof

:cancel
cls
echo.
echo USER CANCELED, Quiting Silently...
goto :eof

::eof

Directions
copy/paste/save as text file (.txt) using Notepad. etc.
rename file *.bat (make sure to change the extension, not just the name)
dbl-click to run/follow prompts (these will appear in a CMD window)

Notices/Disclaimers
works for me
USE AT YOUR OWN RISK