Update-VaultFile returns $null values in Vault 2023

Issue

When calling Update-VaultFile in Vault 2023 for a file that has a state glyph all returned properties have $null as value and multiple warnings are logged.

state_glyph_error_message

powerVault.Cmdlets.Cmdlets.Vault.Facade.VaultPropertyReader - VaultPropertyReader.RetrievePropertyValuesFromVault([ {Bauteil1.ipt} ]) | Failed, exception = {NullReferenceException}

 

powerVault.Cmdlets.Cmdlets.Vault.Facade.VaultPropertyReader - VaultPropertyReader.GetPropertyValues({powerVault.Cmdlets.Cmdlets.Vault.Facade.Files.VaultFileImpl}) | Failed, exception = {NullReferenceException}.

 

powerVault.Cmdlets.Cmdlets.Vault.Facade.VaultPropertyReader+? - ?.get_Value() | Failed, exception = {NullReferenceException}.

Image of a state glyph:

state_glyph

Solution

The warnings can be ignored, but if the property values must be used after the update you can call Get-VaultFile directly after Update-VaultFile to get the correct values.

$updatedFile = Update-VaultFile -File $file._FullName -Properties @{ UDP1 = 'newValue' } 
$updatedFile = Get-VaultFile $file._FullName

Due to "update-vaultfile-returns-null-values-in-vault-2023" this doesn't work right now either. Calling Add-VaultFile causes the old reference to the file object to become stale and also return null values. To get around this the file path can be saved into a separate variable before calling Add-VaultFile. Afterwards you can call other functions to get a new file object.

$_FullPath = $file._FullPath 
$updatedFile = Update-VaultFile -File $file._FullName -Properties @{ UDP1 = 'newValue' }
$updatedFile = Get-VaultFile -File $_FullPath