When working with Vault items in scripts it is often needed to update the item. In the Vault Client you can do this using the context menu on an item and clicking on "Assign/Update item".

The same can also be done by using the Vault API if you want to automate this procedure for example in a powerJobs Processor job.

Updating items via API

Create a new PowerShell script. If you plan to use this as a powerJobs Processor job you don't need to log into Vault.

Import-Module powerVault
$vault = "Vault"

$server = "localhost"
$user = "Administrator"
$password = ""
Open-VaultConnection -Vault $vault -Server $server -User $user -Password $password

After successfully logging into Vault you can use the Vault API via $vault.

The next step it to get an item that needs to be updated via API to be able to get the $item.RevId property:

$itemNumber = "Assembly1"
$item = $vault.ItemService.GetLatestItemByItemNumber($itemNumber)

The following code then finally assigns/updates the item that requires update and commits it:

try {
  if(-not $item.Locked) {
    $assignAll = [Autodesk.Connectivity.WebServices.ItemAssignAll]::Default
    $autoAssignDuplicates = $true
    $vault.ItemService.UpdatePromoteComponents($item.RevId, $assignAll, $autoAssignDuplicates)

    $timestamp = [DateTime]::Now
    $components = $vault.ItemService.GetPromoteComponentOrder([ref]$timestamp)

    if($components.PrimaryArray) {
      $vault.ItemService.PromoteComponents($timestamp, $components.PrimaryArray)
      $result = $vault.ItemService.GetPromoteComponentsResults($timestamp)

      $items= @()
      for($i=0; $i -lt $result.ItemRevArray.Length;$i++){
        if($result.StatusArray[$i] -gt 1){ #RevStatus 1: Unaffected
          $items += $result.ItemRevArray[$i]
}catch {
  foreach ($item in $items) {

In case of errors the changes to Item will be undone.

See Also

Assign Items (Autodesk )