Cancel an event subscription.
Syntax Unregister-Event [-SubscriptionId] int [-Force] [-Confirm] [-WhatIf] [CommonParameters] Unregister-Event [-SourceIdentifier] string [-Force] [-Confirm] [-WhatIf][CommonParameters] Key: -SubscriptionId int Cancel event subscriptions that have the subscription identifier int. -SourceIdentifier string Cancel event subscriptions that have the source identifier string. -Force Cancel all event subscriptions, including subscriptions that were hidden by using the SupportEvent parameter of Register-ObjectEvent, Register-WmiEvent, and Register-EngineEvent. -Confirm Prompt for confirmation before executing the command. -WhatIf Describes what would happen if you executed the command without actually executing the command. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Unregister-Event 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 a subscription to an event created with New-Event is cancelled, the new event is also deleted from the session.
Unregister-Event does not delete events from the event queue. To delete events, use Remove-Event
Cancel the event subscription with a source identifier of "ProcessStarted":
PS C:\> unregister-event -sourceIdentifier ProcessStarted
Cancel all event subscriptions in the session.:
PS C:\> get-eventsubscriber -force | unregister-event -force
“If slaughterhouses had glass walls, everyone would be a vegetarian” ~ Paul McCartney
New-Event - Create a new event
Get-Event - Get events in the event queue
Remove-Event - Delete events from the event queue
© Copyright SS64.com 1999-2013
Some rights reserved