PowerShell 2.0: One Cmdlet at a Time 67 Remove-EventLog

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-EventLog cmdlet.

What can I do with it?

Remove an Event Log.

Example:

Remove the Event Log named App1 on the remote computer Test01. Confirm it has been removed with Get-EventLog.

Remove-EventLog -LogName App1 -ComputerName Test01 Get-EventLog -List -ComputerName Test01

Confirmation that the App1 Event Log has been removed.

Note: To perform this task remotely you will need to ensure that Remote Event Log Management has been added as an Exception in Windows Firewall.

How could I have done this in PowerShell 1.0?

You could have have used the .NET System.Diagnostics.Eventlog class and the Delete method to delete an event log.

[system.diagnostics.eventlog]::Delete(“App1”) 1000 things 1% better!