Clearing Windows Event Log

[quote quote=222990]Check this out “PowerShell Clear-WinEvent” at

https://www.computerperformance.co.uk/powershell/clear-winevent/

Hopefully, it is the answer you are looking for….[/quote]

This works. I wrote up a couple of functions based on [System.Diagnostics.Eventing.Reader.EventLogSession] to backup and clear any windows event log.

Install-Module AZSBTools 
help Backup-EventLog -ShowWindow
help Clear-SBEventLog -ShowWindow

# Example:
$EventLogList = @('Application','Security','Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational')
Backup-EventLog -EventLogName $EventLogList -BackupFolder c:\Sandbox\Logs\Test
Clear-SBEventLog -EventLogName $EventLogList -Confirm:$false