Remove Event - PowerShell
Overview
The Remove-Event
cmdlet removes event registrations from a specified object. Event registrations are created using the Register-Event
cmdlet.
Syntax
Remove-Event -SourceObject <Object> -EventName <String>
The following syntax removes all event registrations from the specified object:
Remove-Event -SourceObject <Object>
Options/Flags
The following options are available:
- -SourceObject: Specifies the object from which to remove event registrations.
- -EventName: Specifies the name of the event to remove registrations for.
Examples
Example 1: Remove a specific event registration
To remove a specific event registration from an object, use the following syntax:
Remove-Event -SourceObject $object -EventName MyEvent
Example 2: Remove all event registrations
To remove all event registrations from an object, use the following syntax:
Remove-Event -SourceObject $object
Common Issues
No common issues are known for this cmdlet.
Integration
The Remove-Event
cmdlet can be used with other PowerShell cmdlets to manage event registrations programmatically. For example, the Get-Event
cmdlet can be used to retrieve information about event registrations, and the Set-Event
cmdlet can be used to modify event registrations.
Related Commands
Get-Event
Register-Event
Set-Event