Remove-Event

Delete events from the PowerShell event queue in the current session.

Syntax
      Remove-Event [-EventIdentifier] int
         [-Confirm] [-WhatIf] [CommonParameters]

      Remove-Event [[-SourceIdentifier] string]
        [-Confirm] [-WhatIf][CommonParameters]

Key:
   -EventIdentifier int
       Remove only the events with the specified event identifier.

   -SourceIdentifier string
       Remove only events with the specified source identifier.
       The default is all events in the event queue.
       Wildcards are not permitted.

   -Confirm
       Prompt for confirmation before executing the command.

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

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

Remove-Event deletes only the events currently in the queue. To cancel event registrations or unsubscribe, use Unregister-Event.

Examples

Delete events with a given source identifier :

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

Delete all events from the event queue:

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

“In the End, we will remember not the words of our enemies, but the silence of our friends” ~ Martin Luther King, Jr

Related:

New-Event - Create a new event
Get-Event - Get events in the event queue
Unregister-Event - Cancel an event subscription


© Copyright SS64.com 1999-2013
Some rights reserved