# Add-VaultRestriction Adds a restriction to block the current operation. ## Syntax ```PowerShell Add-VaultRestriction -EntityName -Message [] ``` ## Parameters | Type | Name | Description | Optional | |--------|------------|--------------------------------------------------|----------| | String | EntityName | The title or affected object of the restriction. | no | | String | Message | The message of the restriction. | no | ## Return type **empty** ## Remarks - The commandlet makes it possible to block the executing webservice call and upcoming *Pre*- or *Post* events. - It is possible to add multiple restrictions with the same **EntityName**. - If a Restriction event has multiple subscribers then the event actions of all subscribers are executed even though the first subscriber already sets a restriction. - For Events (e.g [CheckoutFile](/code_reference/objects/event_mappings/file_events/checkoutfile)...) which are only for a single entity, the EntityName is not displayed in the restriction Dialog by the Vault Client. ```{note} The commandlet is **only usable** in the **Restrictions** events (e.g [AddFile_Restrictions](/code_reference/objects/event_mappings/file_events/addfile), [UpdateFileStates_Restrictions](/code_reference/objects/event_mappings/file_events/updatefilestates)...). ``` ## Examples **Adds a restriction for files which state is trying to be changed to released** ```PowerShell Register-VaultEvent -EventName UpdateFileStates_Restrictions -Action { param($files) foreach($file in $files) { if($file._NewState -eq "Released") { Add-VaultRestriction -EntityName $file.Name -Message "File state can't be set to released!" } } } ```