# Add-VaultFile Adds a new file to Vault. ## Syntax ```powershell Add-VaultFile -From -To [-Force ] [-Hidden ] [-Comment ] [-FileClassification ] [] ``` ## Parameters | Type | Name | Description | Default value | Optional | |---------|--------------------------------------------|------------------------------------------------------------|-------------------------------------|----------| | String | From | Absolute Path to a local file | | no | | String | To | Absolute Vault path. It has to include the filename | | no | | Boolean | Force | If the target directory doesn't exist it will be created | True | yes | | Boolean | Hidden | If true the file will not be displayed in the Vault Client | False | yes | | String | Comment | A comment for the checkin | "Generated by coolOrange powerJobs" | yes | | String | [FileClassification]() | The classification of the file. See the table below | False | yes | (code_reference/commandlets/add-vaultfile:file classification)= ### File Classification | Name | Description | |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ConfigurationFactory | A template file (ex. iPart factories). | | ConfigurationMember | A file created from a template (ex. iPart members). | | DesignDocument | A design file containing data derived from a CAD file (ex. IDW or IPN) | | DesignSubstitute | A design which is a substitute for a more complex design file. | | DesignVisualization | A visualization file (ex. DWF). Although the Vault server will accept any file type as a visualization, many Vault clients will only work properly with DWF files. | | ElectricalProject | A electrical CAD project file (ex. wdp). | | None | The default file classification. This should be used for standard CAD files (ex. DWG, IPT, and IAM) and other types. | ## Return type [File]() ← on success\ **empty** ← on failure ## Remarks The cmdlet uploads a local document to the Vault Server, and takes care about adding a new file or performing checkout- and checkin-operations. There are three different situation on how the cmdlet behaves: - When the target Vault-file **does not exist**, then it will be created with the local document - When the target Vault-file **exist** and is **not checked out**, then the Vault-file will be checked-out and rechecked-in with the local document - When the target Vault-file **exist** and is **checked out**, then the local document will be checked-in to Vault When the target Vault-file already **exist** the cmdlet takes care about creating the new Vault-file version with the **exact same File associations** as the previous file version in Vault.\ In other words, the File dependencies and attachments do not become manipulated at all! :::{note} When calling Add-VaultFile with exact same parameters and the same file binary content as the latest file version, the Vault Server will not create a new version of the file, because it detects that nothing has changed! However when changing only the -Comment, the server will also not create a new version. ::: ## Examples **Add File with comment** ```powershell $file = Add-VaultFile -From "C:\Temp\pV_1.ipt" -To "$/PowerVaultTestFiles/pV_7.test" -Comment "Test" ``` **Add hidden visualization file to Vault** ```powershell $file = Add-VaultFile -From "C:\Temp\pV_1.dwf" -To "$/PowerVaultTestFiles/pV_7.test" -FileClassification "DesignVisualization" -Hidden $true ```