In my previous post, we talk about the usage of, New-EventLog and Write-EventLog, and we are almost at completion of this series.
Today we are going to use two more PowerShell cmdlets, Clear-EventLog and Remove-EventLog.
It’s a very simple cmdlet, if you want to clear all event entries from any event log, you can use Clear-EventLog to clear it.
In our “MyPoshShell” event log, you can see there are 4 event entries. Let’s clear our event log.
Note: You have to run these cmdlets as Administrator.
Clear-EventLog -LogName 'MyPoshShell'
Now let’s see if out log is cleared or not, and indeed it is. You can see there are no event entries in the log now.
It’s also another straight forward cmdlet like Clear-EventLog, usage is very simple, type the cmdlet and provide the name of the event log, which you want to delete.
This cmdlet remove complete log, not just entries.
Let’s remove our previously created “MyPoshLog”.
Remove-EventLog -LogName 'MyPoshShell'
Once you run the cmdlet, open the “Event Viewer” and see if logs is still their ;o) .
When you check, our “MyPoshShell” log is not there anymore.
I hope you have enjoyed this series J .
I hope I will come soon with another series.