Delete events from the PowerShell event queue in the current session.
Syntax Remove-Event [-EventIdentifier] int [-Confirm] [-WhatIf] [CommonParameters] Remove-Event [[-SourceIdentifier] string] [-Confirm] [-WhatIf][CommonParameters] Key: -EventIdentifier int Remove only the events with the specified event identifier. -SourceIdentifier string Remove only events with the specified source identifier. The default is all events in the event queue. Wildcards are not permitted. -Confirm Prompt for confirmation before executing the command. -WhatIf Describes what would happen if you executed the command without actually executing the command.
Remove-Event deletes only the events currently in the queue. To cancel event registrations or unsubscribe, use Unregister-Event.
Delete events with a given source identifier :
PS C:\> remove-event -sourceIdentifier "ProcessStarted"
Delete all events from the event queue:
PS C:\> get-event | remove-event
Remove an event monitor SS64EventMonitor previously setup with Register-CimIndicationEvent:
PS C:\> Get-EventSubscriber -SourceIdentifier SS64EventMonitor | Unregister-Event
To also clear out the queue itself:
PS C:\> get-event -SourceIdentifier SS64EventMonitor | Remove-Event
“In the End, we will remember not the words of our enemies, but the silence of our friends” ~ Martin Luther King, Jr
Related PowerShell Cmdlets:
New-Event - Create a new event.
Get-Event - Get events in the event queue.
Unregister-Event - Cancel an event subscription.
Register-CimIndicationEvent - Subscribe to indications using a filter or query expression.