Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Remove-Event

Remove-Event

microsoft.powershell.commands.utility.dll

Synopsis

Deletes events from the event queue.

Syntax

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

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

Detailed 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

-EventIdentifier <Int32>

Deletes only the event with the specified event identifier. An EventIdentifier or SourceIdentifier parameter is required in every command.

Aliases

None

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.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

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

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

System.Management.Automation.PSEventArgs

Return Type

None

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.

Examples

-------------------------- EXAMPLE 1 --------------------------

This command deletes events with a source identifier of "Process Started" from the event queue.

PS C:\>remove-event -sourceIdentifier "ProcessStarted"

-------------------------- EXAMPLE 2 --------------------------

This command deletes the event with an event ID of 30 from the event queue.

PS C:\>remove-event -eventIdentifier 30

-------------------------- EXAMPLE 3 --------------------------

This command deletes all events from the event queue.

PS C:\>get-event | remove-event

Online Version
Get-Event
New-Event
Register-EngineEvent
Register-ObjectEvent
Register-WmiEvent
Remove-Event
Unregister-Event
Wait-Event