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.

Remove-Event

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

2 thoughts on “PowerShell 2.0: One Cmdlet at a Time #100 Remove-Event

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>