How to Clear the Windows Event Log using the Clear-EventLog Cmdlet

The Cluttered Event Viewer

The Windows Event Viewer is the primary diagnostic tool for system administrators. Every service start, network failure, and application crash is recorded in these logs. However, if you are actively troubleshooting a complex issue—such as a custom .NET application failing to bind to a specific port—the sheer volume of background noise in the Application or System log can make it impossible to isolate the specific error you are triggering.

To conduct a clean test, administrators will often clear the entire log, reproduce the error, and then immediately check the log again. While you can right-click and clear logs in the Event Viewer GUI, PowerShell allows you to instantly purge logs directly from your command-line workflow.

Using the Clear-EventLog Cmdlet

Because the Event Logs are a critical component of system auditing and security forensics, Windows fiercely protects them. You cannot clear an event log as a standard user; you must run PowerShell with elevated Administrator privileges.

To clear a standard log, use the Clear-EventLog cmdlet followed by the -LogName parameter.

For example, to instantly wipe the massive Application log, execute:

Clear-EventLog -LogName Application

The command executes silently. If you open the Event Viewer, you will find the Application log is completely empty, save for a single new entry generated by the system stating, “The Application log was cleared.”

Clearing Multiple Logs Simultaneously

If you are diagnosing a system-wide failure, you may want to start with a completely clean slate across the board. You can pass a comma-separated list of log names to the cmdlet to clear them all simultaneously.

Clear-EventLog -LogName Application, System, Security

Note: Clearing the Security log is often blocked by Group Policy in enterprise environments, as it destroys audit trails required for compliance regulations (like HIPAA or PCI-DSS). Attempting to clear it without explicit domain permission will result in an Access Denied error.

Clearing Logs on Remote Servers

If an IIS Web Server in your DMZ is malfunctioning, you do not need to RDP into the server to clear its logs for troubleshooting. Clear-EventLog natively supports remote execution without requiring full WinRM session creation.

Simply append the -ComputerName parameter:

Clear-EventLog -LogName Application -ComputerName "WEB-SRV-01"

The Modern Clear-WinEvent Alternative

It is important to note that Clear-EventLog only works on the classic Windows logs (Application, System, Security, Setup). If you need to clear a deeply nested, modern ETW (Event Tracing for Windows) log—such as the Microsoft-Windows-TerminalServices log—the classic cmdlet will fail.

For modern, application-specific operational logs, you should use the newer wevtutil command-line tool, or the Remove-EventLog cmdlet for sweeping purges.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.