Deletes events from the event queue.
Remove-Event [-SourceIdentifier*] <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-Event [-EventIdentifier*] <Int32> [-Confirm] [-WhatIf] [<CommonParameters>]
The Remove-Event cmdlet deletes events from the event queue in the current session.
This cmdlet deletes only the events currently in the queue. To cancel event registrations or unsubscribe, use the Unregister-Event cmdlet.
You can pipe events from Get-Event to Remove-Event.
The cmdlet does not generate any output.
- Remove an event by source identifier:
PS C:> Remove-Event -SourceIdentifier "ProcessStarted"
This command deletes events with a source identifier of Process Started from the event queue.
- Remove an event by event identifier:
PS C:> Remove-Event -EventIdentifier 30
This command deletes the event with an event ID of 30 from the event queue.
- Remove all events:
PS C:> Get-Event | Remove-Event
This command deletes all events from the event queue.
Events, event subscriptions, and the event queue exist only in the current session. If you close the current session, the event queue is discarded and the event subscription is canceled.