This article shows how to display the Vault login dialog to connect to Vault instead of connecting directly in the script using the Open-VaultConnection Cmdlet. This can be useful in cases where the script should not contain clear passwords. This solution requires user input to pass the credentials.
Show the Vault login dialog
First you need to load the DLL "Autodesk.DataManagement.Client.Framework.Vault.Forms.dll" using Add-Type:
Add-Type -path "C:\Program Files\Autodesk\Vault <VERSION>\Explorer\Autodesk.DataManagement.Client.Framework.Vault.Forms.dll"
After the DLL is imported correctly you can display the Vault login dialog using the following code:
$global:VaultConnection = [Autodesk.DataManagement.Client.Framework.Vault.Forms.Library]::Login($null)
using "$VaultConnection.WebServiceManager" you have access to the Vault API. To be able to access it the same way as in powerVault trough the $vault variable you can use the following code:
$global:Vault = $VaultConnection.WebServiceManager