# Unregister-VaultEvent Unregisters from vault events, in order that the [registered actions](/code_reference/commandlets/register-vaultevent) do not get invoked any more when the events are raised. ## Syntax ```PowerShell Unregister-VaultEvent [-EventName ] [-SourceIdentifier ] [] ``` ## Parameters | Type | Name | Description | Optional | |-------------------------------------------------------|------------------|----------------------------------------------------------------------------------------------------------|----------| | [VaultEvent](/code_reference/objects/event_mappings) | EventName | The name of the Vault event from which to unregister | yes | | String | SourceIdentifier | Unregister a specific registration by specifying it's [SourceIdentifier](/code_reference/objects/event) | yes | ## Return type [Event[]](/code_reference/objects/event) \<- on success\ **empty** \<- on failure ## Remarks The commandlet unregisters specific (or all) registrations from vault events.\ That means, when a specific vault event is raised, the [registered](/code_reference/commandlets/register-vaultevent) powerEvents will not be executed any more. In order to unregister a *specific registration*, you need access to the [result](/code_reference/objects/event) from the [](/code_reference/commandlets/register-vaultevent) cmdlet, in order to detach the registration via it's *SourceIdentifier*.\ When all registrations should be detached from a *specific vault event*, only the *EventName* of the required Vault event can be used.\ Additionally it's also possible to unregister from *all registrations* from *all Vault events*, by *not specifying any parameters*. The commandlet returns the unregistered events. ## Examples **Unregister from a specific registration:** ```PowerShell $event = Register-VaultEvent -EventName UpdateFileStates_Post -Action { param($files) } Unregister-VaultEvent -SourceIdentifier $event.SourceIdentifier ``` **Unregister from the registration after the State of a file become updated:** ```PowerShell Register-VaultEvent -EventName UpdateFileStates_Post -SourceIdentifier 'AddLog_on_UpdateFileStatesPost' -Action "Add-Log" function Add-Log($file) { Write-Host -Object "$($file._Name)" Unregister-VaultEvent -SourceIdentifier 'AddLog_on_UpdateFileStatesPost' } ``` **Unregisters all the registrations from the AddFile_Post event:** ```PowerShell Register-VaultEvent -EventName AddFile_Post -Action { param( $file ) Write-Host -Object "Added file $($file._Name)" } function DoNothing($file) {} Register-VaultEvent -EventName AddFile_Post -Action "DoNothing" Unregister-VaultEvent -EventName AddFile_Post ``` **Unregisters all the registrations:** ```PowerShell Register-VaultEvent -EventName EditItems_Restrictions -Action { ; } Register-VaultEvent -EventName UpdateFileStates_Post -Action { ; } Register-VaultEvent -EventName MoveFile_Pre -Action { ; } Unregister-VaultEvent ```