PowerShell 2.0: One Cmdlet at a Time 99 Unregister-Event
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Unregister-Event cmdlet.
What can I do with it?
Clear an event subscription.
Example:
Use Get-EventSubscriber to retrive details of current events. Clear the event with subscription id 1 and Get-EventSubscriber again to confirm that it has been removed.
Get-EventSubscriber Unregister-Event -SubscriptionId 1 Get-EventSubscriber
You will see that the event subscription has been cleared.
How could I have done this in PowerShell 1.0?
PowerShell engine events are a new feature in PowerShell 2.0.