Friday, August 8, 2014

Starting with Vault2014powerConsole

Specifically for Autodesk Vault programming lectures by ZippyBytes, the PowerShell-based (Wikipedia, MSDN) module is designed.

Installing Vault 2014 PowerConsole

  1. Make sure that PowerShell is installed on your system. E.g. through Start menu, or executing powershell command from cmd.
  2. If PowerShell is not installed, install it using How to Install Windows PowerShell 4.0 article.
  3. Check PowerShell version by $PSVersionTable.PSVersion (Stack Overflow) command. If version is less than 4.0, you are recommended to update it to 4.0 using Windows Management Framework 4.0. Be sure to read the installation instructions and system requirements.
  4. Check execution policy by Get-ExecutionPolicy cmdlet. If it no equals RemoteSigned (e.g. Restricted), set it up by Set-ExecutionPolicy RemoteSigned.
  5. Download Vault2014PowerConsole.exe package from GitHub. Source code also available.
  6. Installation puts module files into c:\Users\[CurrentUser]\Documents\WindowsPowerShell\Modules\Vault2014PowerConsole directory, and also creates shortcuts in Start menu under ZippyBytes folder.

Starting with Vault 2014 PowerConsole

Connecting Vault

You can connect Vault using following cmdlets:

Connect-VaultCMD

Connects Vault through command prompt. Usage examples:
Connect-VaultCMD
After the launching cmdlet it will ask you for all parameters: server, vault, username, password.



Such approach is useful for scripting outside Vault 2014 PowerConsole. You are importing module first, then establishing connection. Example:



Connect-VaultVDF

Calling regular Vault login dialog.


Module variables

Fore useful dealing with module, next variables are defined:
  • vltActiveConn - current active connection
  • vltAdminSvc - AdminService
  • vltDocumentSvc - DocumentService
  • vltFilestoreSvc - FilestoreService
  • vltFolderCurrent - current folder, object of Autodesk.Connectivity.WebServices.Folder class
  • vltGroups - list of groups, an array of Autodesk.Connectivity.WebServices.Group objects
  • vltRoles - list of roles, an array of Autodesk.Connectivity.WebServices.Roles objects
  • vltUsers - list of users, an array of Autodesk.Connectivity.WebServices.Users objects
Note: place $ sign before variable to access it.

Module cmdlets

Next module cmdlets are available (you can get list of them by Get-Command -Module Vault2014PowerConsole):
  • Add-VaultFile
  • Add-VaultFileHidden
  • Add-VaultFolder
  • Add-VaultFolderLibrary
  • Connect-VaultCMD
  • Connect-VaultVDF
  • Disconnect-Vault
  • Get-FilePath
  • Get-VaultAllConnections
  • Get-VaultChildItem
  • Get-VaultFolder
  • Get-VaultPowerConsoleHelp
  • Get-VaultVariables
  • Get-VaultVariablesDescriptions
  • Set-VaultActiveConnection
  • Set-VaultLocation
  • Set-VaultVariables
To access cmdlet info use Get-Help cmdletName.