How to Clear Event Logs with PowerShell (Clear-EventLog)

To clear event logs with PowerShell, open the console as administrator and run Clear-EventLog with the log name. It wipes every entry in that classic log:

Clear-EventLog -LogName Application

In this tutorial, I’ll show you how to clear event logs in PowerShell safely: check their size, preview with -WhatIf, back them up, then clear one log, every log or a remote PC’s logs.

Check the Event Log Size Before You Clear It

Get-WinEvent -ListLog reads each log’s settings without touching the events. I filtered it to four standard logs:

Get-WinEvent -ListLog Application, System, 'Windows PowerShell', Setup |
    Select-Object LogName, RecordCount,
        @{ n = 'SizeMB'; e = { [int]($_.FileSize / 1MB) } }, LogMode

Output:

LogName            RecordCount SizeMB  LogMode
-------            ----------- ------  -------
Application              53123     20 Circular
System                   36321     20 Circular
Windows PowerShell        8292     15 Circular
Setup                     2432      1 Circular
Get-WinEvent -ListLog showing record count and size of the Application, System, Windows PowerShell and Setup logs in Windows PowerShell 5.1
Record count and file size of four standard logs (Windows PowerShell 5.1)

RecordCount is the number of events; Circular means old events get overwritten when the log is full. Our guide to reading Windows event logs shows how to look at the events themselves.

The older Get-EventLog cmdlet lists the classic logs, the only ones Clear-EventLog can clear:

Get-EventLog -List |
    Where-Object Log -in 'Application', 'System', 'Windows PowerShell'

Output:

  Max(K) Retain OverflowAction        Entries Log
  ------ ------ --------------        ------- ---
  20,480      0 OverwriteAsNeeded      53,123 Application
  20,480      0 OverwriteAsNeeded      36,321 System
  15,360      0 OverwriteAsNeeded       8,307 Windows PowerShell

Unfiltered, it also lists vendor logs from hardware and app makers. The output above is from PowerShell 7.

Why Do You Need Administrator Rights to Clear Event Logs?

Microsoft Learn says Clear-EventLog needs membership in the local Administrators group, and the window must be started with Run as administrator. A quick check tells you where you stand:

$id = [Security.Principal.WindowsIdentity]::GetCurrent()
$admin = ([Security.Principal.WindowsPrincipal]$id).IsInRole(
    [Security.Principal.WindowsBuiltInRole]::Administrator)
if ($admin) {
    'Elevated. You can clear event logs.'
}
else {
    'Failed. Open PowerShell with Run as administrator first.'
}

Output:

Failed. Open PowerShell with Run as administrator first.

My test window wasn’t elevated on purpose, so every clear command below is shown as code only.

Without admin rights, all three clear methods are refused. Clear-EventLog says “Requested registry access is not allowed.”, wevtutil prints “Access is denied.” with exit code 5, and ClearLog throws “Attempted to perform an unauthorized operation.”

To stop a script before it fails halfway, put #Requires -RunAsAdministrator at the top, or wrap the call in try and catch in PowerShell with -ErrorAction Stop.

Preview the Clear With -WhatIf

-WhatIf names each log Clear-EventLog would wipe, changes nothing and needs no admin rights:

Clear-EventLog -LogName 'Windows PowerShell' -WhatIf
Clear-EventLog -LogName Application, System -WhatIf

Output:

What if: Performing the operation "Clear-EventLog" on target "Do you want to clear the "Windows PowerShell" log on the computer "localhost"?".
What if: Performing the operation "Clear-EventLog" on target "Do you want to clear the "Application" log on the computer "localhost"?".
What if: Performing the operation "Clear-EventLog" on target "Do you want to clear the "System" log on the computer "localhost"?".

-LogName accepts several names, so one command can clear Application and System together.

How Do I Clear a Specific Event Log in PowerShell?

In an elevated window, drop -WhatIf. These three commands each clear the Application log:

Clear-EventLog -LogName Application

wevtutil cl Application

[System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog('Application')

Clear-EventLog only handles classic logs such as Application, System and Windows PowerShell. For newer logs like Microsoft-Windows-PowerShell/Operational, use wevtutil or ClearLog with the full log name:

wevtutil cl 'Microsoft-Windows-PowerShell/Operational'

That Operational log fills up fast once you enable PowerShell logging, so it’s a common one to clear.

Back Up an Event Log Before Clearing It

Cleared events are gone for good, so export a copy first. wevtutil epl worked without admin rights here:

$folder = 'C:\psfaqs\t\clearevent'
$file = Join-Path $folder "WindowsPowerShell-$(Get-Date -Format 'yyyy-MM-dd').evtx"
wevtutil epl 'Windows PowerShell' $file /ow:true
"Exit code: $LASTEXITCODE"
$size = (Get-Item $file).Length / 1MB
"Backup: {0} ({1:N1} MB)" -f (Split-Path $file -Leaf), $size
$count = (Get-WinEvent -Path $file | Measure-Object).Count
"Events in the backup: $count"

Output:

Exit code: 0
Backup: WindowsPowerShell-2026-10-20.evtx (15.1 MB)
Events in the backup: 8316
wevtutil epl exporting the Windows PowerShell event log to an evtx backup file in PowerShell 7
The backup is a normal .evtx file that Get-WinEvent can read (PowerShell 7)

Exit code 0 means the export worked, and Get-WinEvent -Path read every event back from the file.

To back up and clear in one step, both wevtutil and ClearLog take a backup path:

wevtutil cl Application /bu:C:\Logs\Application-backup.evtx

$session = [System.Diagnostics.Eventing.Re