Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #99 Unregister-Event

    Posted on May 11th, 2010 Jonathan Medd No comments

    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.

    Unregister-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

    Leave a reply