Clear Windows Event Logs with Wevutil

Description

Clears specified event logs using wevtutil.exe cl, or clears all logs if * is provided.

Overview

The script is designed to clear Windows event logs using the wevtutil.exe cl command. It accepts a list of event log names as input. If * is provided, the script retrieves all available logs on the system and clears them dynamically.

By default, it targets the following logs:

  • Security
  • Application
  • System
  • Microsoft-Windows-PowerShell/Operational
  • Windows PowerShell
  • Microsoft-Windows-Security-Auditing
  • Microsoft-Windows-Sysmon/Operational

Each specified log is cleared in a loop. This script requires administrative privileges to execute successfully and is often used for log maintenance or forensic countermeasures.

Parameters

Name Type Description
Logs string[] A list of event logs to clear, or * to clear all logs. Defaults to a predefined set of logs.
Scroll to Top