Deletes events from the event queue. (Remove-Event)
NAMERemove-EventSYNOPSISDeletes events from the event queue.SYNTAXRemove-Event [-EventIdentifier] <int> [-Confirm] [-WhatIf] [<CommonParameters>] Remove-Event [-SourceIdentifier] <string> [-Confirm] [-WhatIf] [<CommonParameters>]DESCRIPTIONThe 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.PARAMETERS-EventIdentifier <int> Deletes only the event with the specified event identifier. An EventIdentifier or SourceIdentifier parameter is required in every command. Required? true Position? 1 Default value None Accept pipeline input? true (ByPropertyName) Accept wildcard characters? false -SourceIdentifier <string> Deletes only the events with the specified source identifier. Wildcards are not permitted. An EventIdentifier or SourceIdentifier parameter is required in every command. Required? true Position? 1 Default value None Accept pipeline input? false Accept wildcard characters? false -Confirm [<SwitchParameter>] Prompts you for confirmation before executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false -WhatIf [<SwitchParameter>] Describes what would happen if you executed the command without actually executing the command. Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".INPUTSSystem.Management.Automation.PSEventArgs You can pipe events from Get-Event to Remove-Event.OUTPUTSNone The cmdlet does not generate any output.NOTESEvents, 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.Examples
EXAMPLE 1C:\PS>remove-event -sourceIdentifier "ProcessStarted"Description----------- This command deletes events with a source identifier of "Process Started" from the event queue.EXAMPLE 2C:\PS>remove-event -eventIdentifier 30Description----------- This command deletes the event with an event ID of 30 from the event queue.EXAMPLE 3C:\PS>get-event | remove-eventDescription----------- This command deletes all events from the event queue. RELATED LINKS Online version: http://go.microsoft.com/fwlink/?LinkID=135247 Register-ObjectEvent Register-EngineEvent Register-WmiEvent Unregister-Event Get-Event New-Event Remove-Event Wait-Event C:\Windows>powershell get-help Get-EventSubscriber -full
Microsoft Windows [Version 10.0.19045.3693]
Copyright (c) 2023 Microsoft Corporation.
ColorConsole [Version 3.7.1000] PowerShell 2.0-Export