PowerShell 2.0: One Cmdlet at a Time 100 Remove-Event

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

What can I do with it?

Delete an event from the current session. Note: to unsubscribe from an event you will need to use Unregister-Event.

Example:

Retrive current events in the queue with Get-Event, use Remove-Event to clear the event with the SourceIdentifier of Timer, then Get-Event again to confirm that it has been removed.

Get-Event Remove-Event -SourceIdentifier Timer Get-Event

You will see that the event has been cleared.

How could I have done this in PowerShell 1.0?

PowerShell engine events are a new feature in PowerShell 2.0.

1000 things 1% better