How do I Clear All Windows Event Viewer Logs using cmd, PowerShell, c# or VBScript WMI?
Windows Event Viewer displays all the detailed information such as Errors, Warnings and even normal activities. Event Log at times doesn’t automatically remove all the information it stores, and that can be a problem for your computer’s performance as well. This article will show you how to quickly clear all Windows event logs in Event Viewer as needed in Windows 10 using command prompt, PowerShell script, c# command or VBScript / WMI.
Content Summary
Clear all Windows Event Viewer Logs using Command Prompt
Clear all Windows Event Viewer Logs using PowerShell
Clear all Windows Event Viewer Logs using C#
Clear all Windows Event Viewer Logs using BAT or CMD file
Clear all Windows Event Viewer Logs using VBScript / WMI
Step 1: Open Command Prompt and run it as administrator.
Step 2: Type or copy paste the following command into the elevated command prompt and press Enter:
for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"
Step 1: Open an elevated PowerShell prompt.
Step 2: Type or copy paste below command into PowerShell window and press Enter.
wevtutil el | Foreach-Object {wevtutil cl "$_"}
or
Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }
Originally published at pupuweb.com on December 17, 2018.