Error on Inventor start and Vault login when using powerVault in Invenor Datastandard 2022/2023

When importing powerVault cmdlets within Inventor Datastandard scripts the Inventor-Vault addin throws errors on Inventor start and Vault login

Issue

After importing powerVault within a Datastandard4Inventor script the error "Object reference not set to an instance of an object." is displayed on Inventor startup.

When logging in to Vault through the Inventor Vault addin the error "An attempt to access the singleton application object was made before the singleton was created with CommonApp.AssignApplication." is displayed.

Cause

This happens when "Import-Module powerVault" is called directly in script files, outside of a function. Datastandard seems to conflict with the call to 

[coolOrange.VaultServices.Vault.VaultEnvironment]::Instance.Initialize() in the PreImport.ps1 file.

Solution 1

This issue was fixed in powerVault version 23.0.5. Install at least this version in order to fix the issue.

Solution 2

Should it not be possible to update powerVault you can also import the module within your InitializeWindow function to fix the issue: