Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Event Viewer One Click Clear

19 Sep 2009   #9
Zardoc

Windows 7 x64 Ultimate SP1
 
 
Event Viewer One Click Clear

How to Clear Event Viewer with One Click in Windows


...

My System SpecsSystem Spec
27 Oct 2009   #10
Zardoc

Windows 7 x64 Ultimate SP1
 
 

Someone seems to know code better than I do.
Seems to work (I say that because I don't understand the code)

Let's say you don't want to have to press exit key every time. We can modify this way


Code:
@echo off
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.
echo goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
exit
download

Nice. I'll try it a while and check.



Attached Files
File Type: bat Win 7 Clear Viewer V2.bat (287 Bytes, 899 views)
My System SpecsSystem Spec
29 Oct 2009   #11
chicane

Windows 7
 
 

I am logged in as administrator and I keep getting access is denied error when trying to clear out my event logs. Why?

I have tried this script, the command prompt, the event viewer doesn't event have a clear function available. Can anyone help?
My System SpecsSystem Spec
30 Oct 2009   #12
Zardoc

Windows 7 x64 Ultimate SP1
 
 

Hi and welcome to the forums.


Even if you are logged in as administrator you must right click the command and choose run as administrator for it to work.
My System SpecsSystem Spec
20 Nov 2009   #13
Nobax

Windows 7 Ultimate
 
 

Thanks..!
My System SpecsSystem Spec
.


20 Nov 2009   #14
derekimo

Microsoft Community Contributor Award Recipient

Windows 7 Pro 64 SP1
 
 

Wow, Thank's Zardoc, That is a major timesaver!
My System SpecsSystem Spec
21 Nov 2009   #15
Zardoc

Windows 7 x64 Ultimate SP1
 
 

Pleasure dude.

Give rep if you like.
My System SpecsSystem Spec
21 Nov 2009   #16
derekimo

Microsoft Community Contributor Award Recipient

Windows 7 Pro 64 SP1
 
 

Quote   Quote: Originally Posted by Zardoc View Post
Pleasure dude.

Give rep if you like.
I Like, and I did + rep.
My System SpecsSystem Spec
21 Nov 2009   #17
Zardoc

Windows 7 x64 Ultimate SP1
 
 

Thanks Derek.

Happy you like it.
My System SpecsSystem Spec
31 Jan 2010   #18
RandyD123

Win7 x64
 
 

Quote   Quote: Originally Posted by lightningltd View Post
This is an even shorter script to clear the event logs and will cover new logs as well as the current ones (Don't remember who I got it from, but works fantastically):

Attachment 33164
OR you could also paste the following into a new batch file:

@echo off
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.
echo Event Logs have been cleared! ^<press any key^>
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo ^<press any key^>
:theEnd
pause>NUL

This is way better than the first batch file that was posted!!!! Thanks lightningltd!!!
My System SpecsSystem Spec
01 Feb 2010   #19
Zardoc

Windows 7 x64 Ultimate SP1
 
 

Thanks Randy, but if you read the whole post, I have a modified one in shorter than that and it does the same job.

My System SpecsSystem Spec
Comment

 Event Viewer One Click Clear




Tutorial Tools



Similar help and support threads for2: Event Viewer One Click Clear
Windows 7 Tutorial Category
In Event Viewer, Where is event log for cleanmgr.exe (Disk Cleanup)? Performance & Maintenance
Solved Event Viewer Warning - Source e1yexpress - Event ID 27 General Discussion
How To Clear Administrative Events Log - Event Viewer Performance & Maintenance
WHEA-Logger event 18/19 errors in Event Viewer (W7 Home Premium) Hardware & Devices
Event Viewer Error Message Event ID11 - How do I get rid of this to? BSOD Help and Support
Event 18 WHEA-Logger Error in Event Viewer Hardware & Devices
How to clear events in viewer? General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:59 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33