Closed bravo-kernel closed 3 years ago
This exception is thrown usually when an incompatible .Net binary is loaded. SecretManagement and SecretStore are both PowerShell binary modules and so only one version of the module binary can be loaded in .Net before you need to start a new instance of PowerShell. This is just a known issue with PowerShell binary modules.
To be safe you should always uninstall any earlier versions of SecretManagement (and SecretStore if you are using the extension vault) before installing a new version. Also try starting a new PowerShell instance (but this isn't always needed).
Get-Module -Name Microsoft.PowerShell.Secret* -List
Uninstall-Module Microsoft.PowerShell.SecretStore -Force
Uninstall-Module Microsoft.PowerShell.SecretManagement -Force
...
Also you can usually get more information on the error by looking at error exception and inner exceptions. Many times PowerShell will bury the original exception.
$err = Get-Error
$err.Exception
$err.Exception.InnerException
...
Thank you for the quick reply and the very good Get-Error
pointer.
The issue was indeed caused by an incompatible .Net version and resolved by:
Much love ❤️
Awesome module and 0.9.1 works great on one of our machines but running
Get-SecretVault
is throwing the following exception on a pristine Windows Server 2016:Any ideas/pointers on what could be causing this?
Thanks in advance ❤️