Getting started
Start the PowerShell environment
In order to get started either open any Windows PowerShell IDE and load the powerVault Module by calling Import-Module powerVault
or open the powerVault Console shortcut in the start menu, which already loads powerVault for you.
Connect to Vault (optional)
To use the powerVault Cmdlets a Vault connections is required.
In Vault applications (inside powerEvents client customizations or Vault extensions such as Data Standard), the Cmdlet’s automatically detect and reuse the application’s latest Vault connection.
However, in Powershell IDEs where a Vault connection does not already exist, the Open-VaultConnection cmdlet can be used to create a new connection, passing the required credentials.
Get a file from Vault
With the Vault Connection available, you can start working with powerVault.
Lets search for a random file which was created by the connected user:
$user = $vaultConnection.UserName
$file = Get-VaultFile -Properties @{"Created By"=$user}
Examine the file
To check which properties our file has, we have two options.
Either we just let the PowerShell Host print the $file
object or we look at it in the Inspector window by calling the Show-Inspector Cmdlet.
Show-Inspector -Highlight 'file'
Update the file
In case you want to update the file you can achieve this with the Update-VaultFile Cmdlet.
In this example we add an attachement to the file:
$attachment = Get-VaultFile -Properties @{'File Extension'='dwf'} #Search for a .dwf file
$updatedFile = Update-VaultFile -File $file.'Full Path' -Attachments @($attachment.'Full Path') -Comment "Set attachment"
Download the file
You may want to download the file from Vault. For ths operation you can use the Save-VaultFile Cmdlet.
In this example we download the file with the recently added attachement:
$downloadedFiles = Save-VaultFile -File $updatedFile.'Full Path' -IncludeAttachments -DownloadDirectory "C:\Temp\Vault\Sample"
$downloadedFiles | select {$_.LocalPath}
#C:\Temp\Vault\Sample\Designs\InventorTestPE.ipt
#C:\Temp\Vault\Sample\InventorTestPE.dwf