How to Clear All Event Logs in Event Viewer in Windows
Event Viewer is a tool that displays detailed information as event logs about significant events on your PC.
Event logs are special files that record significant events on your PC, such as when a user signs in to the PC or when a app encounters an error. Whenever these types of events occur, Windows records the event in an event log that you can read by using Event Viewer.
Advanced users might find the details in event logs helpful when troubleshooting problems with Windows and other apps. However, you may also wish to be able to quickly clear all event logs at once as needed.
See also: Review events and errors using Event Viewer | Microsoft Docs
This tutorial will show you how to quickly clear all event logs in Event Viewer as needed in Windows 10.
You must be signed in as an administrator to be able clear all event logs.
It is required for the Windows Event Log service to be enabled and running to clear logs in Event Viewer.
This will not clear Analytic or Debug logs. If you have them enabled, the wevutl command returns an error, but all other logs will be cleared.
Clearing all Event Viewer logs will also clear Reliability History.
Contents
- Option One: To Clear All Event Viewer Logs using a BAT file
- Option Two: To Clear All Event Viewer Logs in Command Prompt
- Option Three: To Clear All Event Viewer Logs in PowerShell
- Option Four: To Clear Individual Event Viewer Logs in Event Viewer
EXAMPLE: Event Viewer
1 Click/tap on the Download button below to download the .bat file below.
Clear_Event_Viewer_Logs.bat
Download
Contents of .bat file for reference:
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 All Event Logs have been cleared! goto theEnd :do_clear echo clearing %1 wevtutil.exe cl %1 goto :eof :noAdmin echo Current user permissions to execute this .BAT file are inadequate. echo This .BAT file must be run with administrative privileges. echo Exit now, right click on this .BAT file, and select "Run as administrator". pause >nul :theEnd Exit
2 Save the .bat file to your desktop.
3 Unblock the .bat file.
4 Right click or press and hold on the .bat file, and click/tap on Run as administrator.
5 If prompted by UAC, click/tap on Yes.
6 A command prompt will now open to clear the event logs. The command prompt will automatically close when finished.
1 Open an elevated command prompt.
2 Copy and paste the command below into the elevated command prompt, and press Enter.
for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"
3 The event logs will now be cleared. You can close the command prompt when it's finished.
1 Open an elevated Windows PowerShell.
2 Copy and paste the command below you want to use into the elevated PowerShell, and press Enter.
Get-WinEvent -ListLog * | where {$_.RecordCount} | ForEach-Object -Process { [System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog($_.LogName) }
OR
Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }
OR
wevtutil el | Foreach-Object {wevtutil cl "$_"}
3 The event logs will now be cleared. You can close PowerShell when it's finished.
1 Press the Win + R keys to open the Run dialog, type eventvwr.msc into Run, and click/tap on OK to open Event Viewer.
2 Select a log (ex: Application) that you want to clear in the left pane of Event Viewer, and click/tap on Clear Log in the far right Actions pane. (see screenshot below)
OR
3 Right click or press and hold on a log (ex: Application) that you want to clear in the left pane of Event Viewer, and click/tap on Clear Log. (see screenshot below)
4 Click/tap on Clear to confirm. (see screenshot below)
That's it,
Shawn
Related Tutorials
- How to Read Event Viewer Log for Chkdsk (Check Disk) in Windows 10
- How to Read Shrink Volume Log in Event Viewer in Windows 10
- How to Read Shutdown Event Logs in Windows
- How to Clear Reliability History in Windows 10
- How to Read Logoff and Sign Out Logs in Event Viewer in Windows