< Back

Remove-Event

Tue Jan 29, 2019 10:23 pm

NAME Remove-Event



SYNOPSIS

Deletes events from the event queue.





SYNTAX

Remove-Event [-EventIdentifier] <Int32> [-Confirm] [-WhatIf] [<CommonParameters>]



Remove-Event [-SourceIdentifier] <String> [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

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.





PARAMETERS

-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-EventIdentifier <Int32>

Specifies the event identifier for which the cmdlet deletes. An EventIdentifier or SourceIdentifier parameter is required in every command.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SourceIdentifier <String>

Specifies the source identifier for which this cmdlet deletes events from. Wildcards are not permitted. An EventIdentifier or SourceIdentifier

parameter is required in every command.



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Management.Automation.PSEventArgs

You can pipe events from Get-Event to Remove-Event .





OUTPUTS

None

The cmdlet does not generate any output.





NOTES





* 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.



*



Example 1: 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.

Example 2: 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.

Example 3: Remove all events



PS C:\\>Get-Event | Remove-Event



This command deletes all events from the event queue.



RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=821846

Get-Event

New-EventLog

Register-EngineEvent

Register-ObjectEvent

Remove-EventLog

Unregister-Event

Wait-Event