Clearing WinEvent Logs

by May 28, 2012

With Get-WinEvent you can access the various Windows log files such as this one:

PS> Get-WinEvent Microsoft-Windows-WinRM/Operational

There is no cmdlet to actually clear such event log, though. With this line, you can:

PS> [System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog(' Microsoft-Windows-WinRM/Operational') 

Of course, you need Admin privileges to clear most event logs.

Twitter This Tip! ReTweet this Tip!