header image

CTP3 – Clear-EventLog

Posted by: | December 29, 2008 | No Comment |

Continuing our tour around the event log cmdlets we come to Clear-EventLog.  This does exactly what it says – it clears the entries out of one or more logs. Note that it does not backup the entries in anyway – it is just a clear.

We can clear a single log

Clear-EventLog -LogName "Windows PowerShell"

or we can work with multiple logs – for instance based on the number of records

Get-EventLog -List | Where{$_.Entries.Count -gt 5000} | Foreach {Clear-EventLog -LogName $_.Log}

We need administrator access on Vista and later. The usual –whatif and –confirm parameters are available.  This cmdlet also has a –computername parameter for working with remote machines


Technorati Tags: PowerShell,CTP3,Event Logs

under: PowerShellV2