Event Viewer One Click Clear

How to Clear Event Viewer with One Click in Windows


   Information
This will show you how to create a command line shortcut that will clear all of the Event Viewer logs in one click.



Here is a batch file that can help you clear the event viewer in one click.

Download


Download this file above..

Unzip on your desktop.

You can use the task scheduler to give it a high priority so you won't get a UAC prompt

See Brink's Tip HERE

Or, just copy this script and paste in notepad and save as Clean Viewer.BAT

Right click, and click on Run as administrator to run the file
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

:geek:






 
Last edited by a moderator:
Added Virtual PC clean log.

;)
 

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
Very nice!

I clean the Event log because it gets full of error/warning events...

This will shorten the time needed to clean it out!

Thanks!:geek:
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 SP1 x64
CPU
Intel E8400 3.0 GHz
Motherboard
Gigabyte EP45-DS3R
Memory
4x1 Trascend DDR2 800 Mhz
Graphics Card(s)
Gainward 8800GT 512 Mb
Sound Card
Realtek HD Audio 889A
Monitor(s) Displays
LG L204WS
Screen Resolution
1680x1050
Hard Drives
Intel 520 Series 120Gb SSD (System)
Western Digital 6400AAKS 640Gb (Data)
PSU
Cooler Master 650W
Case
Cooler Master Centurion 532
Cooling
2x 12 cm fans
Keyboard
Logitech Wave
Mouse
Logitech G5
Internet Speed
10 Mbit Cable Flat
Antivirus
NOD32 Smart Security
Browser
Google Chrome
That's the main reason why I created this script. Microsoft is supposed to re examine the viewer to make it less scary with usless warnings.

Happy to help.

:)
 

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
Z

Really nice thanks
 

My Computer

Computer Manufacturer/Model Number
HP Pavillion dv-7 1005 Tx
OS
Win 8 Release candidate 8400
CPU
[email protected]
Memory
4 gigs
Graphics Card(s)
Nvidia 9600M
Sound Card
HD built-in
Monitor(s) Displays
17" Wxga
Screen Resolution
1440x900
Cooling
none
Internet Speed
45Mb down 5Mb up
Very nice.:)
 

My Computer

Computer Manufacturer/Model Number
Samsung NP530U4B-S02IN
OS
Windows® 8 Pro (64-bit)
CPU
Intel® Core™ i5 Processor 2467M (1.60GHz, 3MB L3 Cache)
Motherboard
Samsung Electronics
Memory
6GB DDR3 System Memory at 1,333MHz (on BD 4GB + 2GB x 1)
Graphics Card(s)
AMD Radeon™ HD7550M 1GB DDR3 (Ext. Graphic)
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
35.56cm (14.0) SuperBright 300nit HD LED Display
Screen Resolution
1366x768
Hard Drives
1TB S-ATA II Hard Drive (5400RPM) with ExpressCache 16GB SSD
Internet Speed
sucks
Antivirus
Microsoft Security Essentials
Browser
Google Chrome (Sync enabled)
Pleasure guys.

There's some very good stuff in this section!!

:)
 

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
Very useful, thanks heaps Zardoc!!
 

My Computer

Computer Manufacturer/Model Number
HP Touchsmart IQ771.uk
OS
Windows 7 Ultimate x64
CPU
AMD Turion(tm) 64 X2 Mobile Technology TL-56
Motherboard
ASUS Pheonix
Memory
3GB Nanya PC2-6400 DDR2-SDRAM SO-DIM (400MHz)
Graphics Card(s)
NVIDIA GeForce Go 7600 256MB GDDR3 SDRAM
Sound Card
High Definition Intergrated NVIDIA MCP51
Monitor(s) Displays
46" Sony Bravia HDTV
Screen Resolution
1600x1200
Hard Drives
1.5TB Samsug
320GB Seagate ST3320820AS - SATA 3Gb/s 8MB
500GB Maxtor Basics STM305003EHD301-RK
Internet Speed
↓6.32 Mb/s ↑0.35 Mb/s ↔26ms
Other Info
BIOS - American Megatrends Inc. 5.07
Ethernet Port - NVIDIA nForce 10/100/1000 Mbps
DVD Drive - TSSTcorp DVDR/RW TS-T632L
My pleasure.
 

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
Even shorter event clear script...

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):

View attachment Clear_All_Logs.bat
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
 

My Computer

Computer Manufacturer/Model Number
HP DV7-2270US
OS
Windows 7 64-bit
CPU
Intel Core 2 quad (2000MHZ, 4 core)
Motherboard
HP
Memory
4 Gig
Graphics Card(s)
ATI HD4650
Sound Card
IDT HD and ATI HD
Monitor(s) Displays
17" wide laptop and 65" secondary (for 'work' :) )
Screen Resolution
1600X900
Hard Drives
Patriot 64-Gig M28 SSD in bay 1
Seagate ST9500420AS 500 Gig in bay 2(laptop)
Case
HP Laptop
Internet Speed
T3
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. :)
 

Attachments

Last edited:

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
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 Computer

OS
Windows 7
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.​
 
Last edited:

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
Wow, Thank's Zardoc, That is a major timesaver!:cool:
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Win 10 Pro x64
CPU
Intel I5-2500K @3.3GHz
Motherboard
Asrock P67 Extreme4
Memory
16GB G.Skill Ripjaws X (4x4GB)
Graphics Card(s)
EVGA GeForce 750 Ti SC 2GB
Sound Card
ASUS Xonar DG 5.1 Channels 24-bit 96KHz PCI Interface Sound
Monitor(s) Displays
auria eq2367
Screen Resolution
1920 x 1080
Hard Drives
250GB Samsung 850 EVO SSD
1TB WD Blue
1TB Hitachi
PSU
SeaSonic X 650W 80 Plus Gold
Case
Corsair Obsidian 750D
Cooling
Corsair H60, Three 140mm case fans
Keyboard
Logitech Wireless Keyboard K520
Mouse
Logitech Wireless Mouse M310
Internet Speed
Wave Broadband ~ 100 dn 5 up
Antivirus
Windows Defender, Malwarebytes Premium
Browser
Edge, IE11, Chrome
Other Info
Laptop specs: HP g7-1365dx /
CPU: AMD A6-3420M APU with Radeon(tm) HD Graphics /
RAM: Crucial 8Gb (2x4Gb) /
SSD: Crucial M4-CT128M4SSD2 ATA Device/ FW 000F /
GFX: AMD Radeon HD 6520G /
OS: Windows 10 Pro x64
Pleasure dude.

Give rep if you like.
 

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Win 10 Pro x64
CPU
Intel I5-2500K @3.3GHz
Motherboard
Asrock P67 Extreme4
Memory
16GB G.Skill Ripjaws X (4x4GB)
Graphics Card(s)
EVGA GeForce 750 Ti SC 2GB
Sound Card
ASUS Xonar DG 5.1 Channels 24-bit 96KHz PCI Interface Sound
Monitor(s) Displays
auria eq2367
Screen Resolution
1920 x 1080
Hard Drives
250GB Samsung 850 EVO SSD
1TB WD Blue
1TB Hitachi
PSU
SeaSonic X 650W 80 Plus Gold
Case
Corsair Obsidian 750D
Cooling
Corsair H60, Three 140mm case fans
Keyboard
Logitech Wireless Keyboard K520
Mouse
Logitech Wireless Mouse M310
Internet Speed
Wave Broadband ~ 100 dn 5 up
Antivirus
Windows Defender, Malwarebytes Premium
Browser
Edge, IE11, Chrome
Other Info
Laptop specs: HP g7-1365dx /
CPU: AMD A6-3420M APU with Radeon(tm) HD Graphics /
RAM: Crucial 8Gb (2x4Gb) /
SSD: Crucial M4-CT128M4SSD2 ATA Device/ FW 000F /
GFX: AMD Radeon HD 6520G /
OS: Windows 10 Pro x64
Thanks Derek.

Happy you like it.
 

My Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
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):

View 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 Computer

Computer Manufacturer/Model Number
Dell XPS 8300
OS
Win7 x64
CPU
Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Memory
16GB Dual-Channel
Graphics Card(s)
NVIDIA GeForce GTS 450
Monitor(s) Displays
Viewsonic VX2753mh-LED 27" HDMI
Screen Resolution
1920x1080
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 Computer

Computer Manufacturer/Model Number
Asus
OS
Windows 7 x64 Ultimate SP1
CPU
I5 875K Unlocked
Motherboard
P7P55D-E-PRO
Memory
Kingston HyperX Genesis DDR3-1600MHz 9-9-9-27 @ 1.65V XMP
Graphics Card(s)
EVGA GeForce GTX 570 HD 732 MHz GPU 1280 MB, 152 GB Mem
Sound Card
Onboard Via 1828S
Monitor(s) Displays
Samsung T240 HD
Screen Resolution
Dual 1920X1200 1027X768
Hard Drives
OCZ Vertex II Extended Sandforce SSD 60 Gig 2X WD Black Caviar 1 terabyte 6GBS Transer Sata 3 Marvell Chip
PSU
Corsair Gold fully Modular 80 Plus 850
Case
Coolermaster Half X Full Tower
Cooling
Noctua NH-U12P
Keyboard
MS
Mouse
MS
Internet Speed
Fast enough
Other Info
My fridge has a water tap
Back
Top