CmdID

CmdID / PowerShell / Cmdlets / Unregister

Unregister-Event

Cancels an event subscription. PowerShell reference

From the PowerShell reference 5 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Cancels an event subscription. The Unregister-Event cmdlet cancels an event subscription that was created by using the Register-EngineEvent, Register-ObjectEvent, or Register-WmiEvent cmdlet. When an event subscription is canceled, the event subscriber is deleted from the session and the subscribed events are no longer added to the event queue. When you cancel a subscription to an event created by using the New-Event cmdlet, the new event is also deleted from the session. Unregister-Event does not delete events from the event queue. To delete events, use the Remove-Event cmdlet.

Unregister-Event [-SourceIdentifier] <String> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Unregister-Event [-SubscriptionId] <Int32> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Cancel an event subscription by source identifier

Unregister-Event -SourceIdentifier "ProcessStarted"Identify

Cancel an event subscription by subscription identifier

Unregister-Event -SubscriptionId 2Identify

Cancel all event subscriptions

Get-EventSubscriber -Force | Unregister-Event -ForceIdentify

Its page in the reference: Unregister-Event.

Parameters

5 in the PowerShell reference
-ForceCancels all event subscriptions, including subscriptions that were hidden by using the SupportEvent parameter of Register-ObjectEvent, Register-WmiEvent, and Register-EngineEvent.
-SourceIdentifierSpecifies a source identifier that this cmdlet cancels event subscriptions. A SourceIdentifier or SubscriptionId parameter must be included in every command.
-SubscriptionIdSpecifies a source identifier ID that this cmdlet cancels event subscriptions. A SourceIdentifier or SubscriptionId parameter must be included in every command.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.