Export (0) Print
Expand All

Remove-Event

Updated: April 21, 2010

Applies To: Windows PowerShell 2.0

Deletes events from the event queue.

Syntax

Remove-Event [-EventIdentifier] <int> [-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

-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

Prompts you for confirmation before executing the command.

 

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

 

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This command supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see about_CommonParameters.

Inputs and Outputs

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

 

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

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

Description

-----------

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

Example 2

C:\PS>remove-event -eventIdentifier 30

Description

-----------

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

Example 3

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

Description

-----------

This command deletes all events from the event queue.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft