Get-VaultFile
Retrieves a File from Vault.
It can also be used to download a file to a local directory.
Syntax
Get-VaultFile [-File <String>] [-FileId <Long>] [-Properties <Hashtable>] [-DownloadPath <String>] [<CommonParameters>]
Parameters
Type |
Name |
Description |
Optional |
---|---|---|---|
String |
File |
Absolute Vault path to a file |
yes |
Long |
FileId |
Id or MasterId of the file |
yes |
Hashtable |
Properties |
Search for the file with matching properties |
yes |
String |
DownloadPath |
This is the location where the file and all it’s references will be downloaded |
yes |
Return type
File ← on success
empty ← on failure
Remarks
If the search criteria’s passed to the -Properties argument matches more than one file, then only the first file is returned.
In case you want to get multiple files use the Get-VaultFiles Cmdlet.
In order to search a file by properties the -Properties argument allows to search the values of user defined properties and system properties which can be passed using their:
display names (e.g.
@{'Title' = ...}
can be used with English Vault or@{'Titel' = ...}
can be used with german Vault environments).
The -DownloadPath parameter allows downloading the file and all it’s references into the specified directory.
One goal of this parameter is, that e.g. Inventor file can be opened without problems out from this directory.
The folder structure of the Vault files is maintained, and they will not be renamed.
Therefore the downloaded file is not always located directly within the specified folder and it could have been stored in a subfolder.
To retrieve the actual location, you can use the additional property LocalPath
.
Note
For additional download options use the Save-VaultFile cmdlet.
Examples
Get File via absolute Vault path
$file = Get-VaultFile -File '$/PowerVaultTestFiles/pV_6.idw'
Get File that matches certain search criteria’s
$file = Get-VaultFile -Properties @{"Description" = "TEMPLATE"; "Part Number" = "Dial"}
Downloading the file
$file = Get-VaultFile -File '$/Assemblies/Catch Assembly.iam' -DownloadPath "C:\Temp\Test\Download"
$actualDownloadLocation = $file.LocalPath
If the directory “C:\Temp\Test\Download” does not exist, it will be created.