| external help file | Microsoft.PowerShell.Commands.Utility.dll-Help.xml |
|---|---|
| Locale | en-US |
| Module Name | Microsoft.PowerShell.Utility |
| ms.date | 12/12/2022 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/remove-event?view=powershell-7.6&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Remove-Event |
Deletes events from the event queue.
Remove-Event [-SourceIdentifier] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-Event [-EventIdentifier] <Int32> [-WhatIf] [-Confirm] [<CommonParameters>]
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.
PS C:\> Remove-Event -SourceIdentifier "ProcessStarted"
This command deletes events with a source identifier of Process Started from the event queue.
PS C:\> Remove-Event -EventIdentifier 30
This command deletes the event with an event ID of 30 from the event queue.
PS C:\> Get-Event | Remove-Event
This command deletes all events from the event queue.
Specifies the event identifier for which the cmdlet deletes. An EventIdentifier or SourceIdentifier parameter is required in every command.
Type: System.Int32
Parameter Sets: ByIdentifier
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the source identifier for which this cmdlet deletes events from. Wildcards are not permitted. An EventIdentifier or SourceIdentifier parameter is required in every command.
Type: System.String
Parameter Sets: BySource
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe events from Get-Event to this cmdlet.
This cmdlet returns no output.
No event sources available on the Linux or macOS platforms.
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.