# Update-VaultFile Updates a File in Vault or manipulates its associations. ## Syntax ```powershell Update-VaultFile -File [-Comment ] [-Category ] [-State ] [-LifecycleDefinition ] [-Revision ] [-RevisionDefinition ] [-Properties ] [-AddChildren ] [-Children ] [-RemoveChildren String[]>] [-AddAttachments ] [-Attachments ] [-RemoveAttachments ] [] ``` ## Parameters | Type | Name | Description | Optional | | ---------- | ------------------- | ------------------------------------------------------------------------------------------ | -------- | | String | File | Full path to the Vault file, that should be updated | no | | String | Comment | The comment associated with the new Vault file version | yes | | String | Category | The name of the new category that should be assigned to the Vault file | yes | | String | State | The name of the new lifecycle state for the Vault file | yes | | String | LifecycleDefinition | The name of the new lifecycle definition that should be assigned to the Vault file | yes | | String | Revision | The new revision number of the Vault file | yes | | String | RevisionDefinition | The name of the revision definition that should be assigned to the Vault file | yes | | Hashtable | Properties | The user-defined properties and their values which should be updated on the Vault file | yes | | String\[\] | AddChildren | Full paths to the Vault files that should be associated as new children of the Vault file | yes | | String\[\] | Children | Full paths to the Vault files that will replace the existing children of the Vault file | yes | | String\[\] | RemoveChildren | Full paths to the Vault files which should be removed from the children of the Vault file | yes | | String\[\] | AddAttachments | Full paths to the Vault files that should be attached to the Vault file | yes | | String\[\] | Attachments | Full paths to the Vault files that will replace the existing attachments of the Vault file | yes | | String\[\] | RemoveAttachments | Full paths to the Vault files which should be detached from the Vault file | yes | ## Return type [File]() ← on success **empty** ← on failure. Exception/ErrorMessage can be accessed using [\$Error](). ## Remarks To update the **RevisionDefinition** it is important to check current Revision on the file, if the RevisionDefinition is changed, most of the time the Revision needs to be passed too. Similar for changing the **LifeCycleDefinition**: when assigning a new LifeCycleDefinition and the current state of the file does not exist in the new LifeCycleDefinition, then the **-State** must be passed too. To update properties of a Vault file the **-Properties** argument allows updating the values of used-defined properties which can be passed using their: - *system names* are predefined with '\_' and can be used with all Vault language environments (e.g. `@{'_Title' = ...}` ) - *display names* (e.g. `@{'Title' = ...}` can be used with English Vault or `@{'Titel' = ...}` can be used with german Vault environments). **References**: To add Vault files as dependencies the **-AddChildren** parameter can be used, it accepts an array of Vault file paths. To add Vault files as attachments the **-AddAttachments** parameter can be used, it accepts an array of Vault file paths. To replace all existing dependencies or attachments the **-Child** or **-Attachments** parameters can be used. To remove individual dependencies or attachments the **-RemoveAttachments** or **-RemoveChildren** parameter can be used. When some existing references are checked-out, then the *latest checked-in version of the reference* will be used. :::{note} It is only possible to perform changes that can also be performed through the Vault Explorer. For example it is not possible to change the state of a file to something that isn't defined in the lifecycle definition. ::: :::{warning} Due to a dependency on the Vault Explorer installation, usage of the `-Properties` parameter is only supported on the framework matching the installed Vault Explorer for 2025 and 2026. | Vault Explorer Version | Windows PowerShell (5.1) | PowerShell Core (7.4) | | -------------------------------- | ------------------------ | ------------------------------------------------------- | | Vault 2025 (.NET Framework v4.8) | Supported | Not Supported (only Supported in VDS for Inventor 2025) | | Vault 2026 (.NETCoreApp v8.0) | Not Supported | Supported | ::: ## Examples **Update the lifecycle state and definition of a file in Vault:** ```powershell $file = Get-VaultFile -File "$/Designs/Pad Lock.iam" $updated = Update-VaultFile -File $file.'Full Path' -LifecycleDefinition "Flexible Release Process" -State "Work in Progress" ``` **Update the revision number and definition of a Vault file:** ```powershell $file = Get-VaultFile -File "$/Designs/Pad Lock.iam" $updated = Update-VaultFile -File $file.'Full Path' -Revision "B" -RevisionDefinition "Standard Alphabetic Format" -Comment "Revision updated" ``` **Assign attachments of a Vault file:** ```powershell $parent = Get-VaultFile -File "$/Designs/pV_4.iam" $child = Add-VaultFile -From "C:\Temp\pV_1.ipt" -To "$/Designs/pV_4_3.ipt" $parentUpdated = Update-VaultFile -File $parent.'Full Path' -Attachments @($child.'Full Path') -Comment "Set one attachment only" ``` **Remove child dependencies from a Vault file:** ```powershell $parent = Get-VaultFile -File "$/Designs/pV_2.iam" $child1 = Get-VaultFile -File "$/Designs/pV_2_1.ipt" $child2 = Get-VaultFile -File "$/Designs/pV_2_2.ipt" $child3 = Get-VaultFile -File "$/Designs/pV_2_3.ipt" $parentUpdated = Update-VaultFile -File $parent.'Full Path' -RemoveChildren @($child3.'Full Path') -Comment "Child 3 removed" ``` **Error handling, analyze why file could not be updated using \$Error:** ```powershell $file = Update-VaultFile -File "$/Designs/Inventor 2015/Padlock/Internal/Dial.idw" -Attachments @("$/Designs/Inventor 2015/Padlock/Internal/Dial.idw.pdf") if(-not $file){ $Error[0].Exception #Returns: "You do not have adequate permissions to perform this operation. Contact your administrator. (Code: 303)" } ```