Remove-Event
Published: February 29, 2012
Updated: August 15, 2012
Applies To: Windows PowerShell 2.0, Windows PowerShell 3.0
Remove-Event
Syntax
Parameter Set: BySource Remove-Event [-SourceIdentifier] <String> [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: ByIdentifier Remove-Event [-EventIdentifier] <Int32> [-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
Prompts you for confirmation before running the cmdlet.
|
Required? |
false |
|
Position? |
named |
|
Default Value |
false |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-WhatIf
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, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
-
System.Management.Automation.PSEventArgs
You can pipe events from Get-Event to Remove-Event.
Outputs
The output type is the type of the objects that the cmdlet emits.
-
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.
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
Related topics
Get-Event
New-Event
Register-EngineEvent
Register-ObjectEvent
Register-WmiEvent
Remove-Event
Unregister-Event
Wait-Event