Unregisters from vault events, in order that the registered actions do not get invoked any more when the events are raised.

Unregister-VaultEvent [-EventName <String>] [-SourceIdentifier <string>] [<CommonParameters>]

Type Name Description Optional
VaultEventEventNameThe name of the Vault event from which to unregisterno
StringSourceIdentifierUnregister a specific registration by specifying it's SourceIdentifierno

Event[] ← on success
empty ← on failure

The commandlet unregisters specific (or all) registrations from vault events.
That means, when a specific vault event is raised, the registered powerEvents will not be executed any more.

In order to unregister a specifc registration, you need access to the result from the 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.

Unregister from a specific registration:

$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:

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:

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:

Register-VaultEvent -EventName EditItems_Restrictions -Action { ; }
Register-VaultEvent -EventName UpdateFileStates_Post -Action { ; }
Register-VaultEvent -EventName MoveFile_Pre -Action { ; }