Skip to content

Set-Secret and Get-SecretStoreConfiguration throws an exception as a normal user #28

@swinster

Description

@swinster

Installed both SecretManagement and SecretStore from an elevated prompt. Then registered two SecretStore vaults, one under and Administrator scope via the elevated prompt, and one as a normal user scope. When attempting to Set-Secret as the normal user, the exception is :

PS C:\Users\Me> Set-Secret -Name MySecret Secret "TestSecret"
Exception calling "GetInstance" with "0" argument(s): "The type initializer for
'Microsoft.PowerShell.SecretStore.SecureStoreFile' threw an exception."
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.PowerShell.SecretStore\0.5.2\Microsoft.PowerShell.SecretStore.E
xtension\Microsoft.PowerShell.SecretStore.Extension.psm1:123 char:17
+ ...         if ([Microsoft.PowerShell.SecretStore.LocalSecretStore]::GetI ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TypeInitializationException

Exception calling "GetInstance" with "0" argument(s): "The type initializer for
'Microsoft.PowerShell.SecretStore.SecureStoreFile' threw an exception."
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.PowerShell.SecretStore\0.5.2\Microsoft.PowerShell.SecretStore.E
xtension\Microsoft.PowerShell.SecretStore.Extension.psm1:123 char:17
+ ...         if ([Microsoft.PowerShell.SecretStore.LocalSecretStore]::GetI ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TypeInitializationException

Even running Get-SecretStoreConfiguration under the normal user scope results in:

PS C:\Users\Me> Get-SecretStoreConfiguration
Get-SecretStoreConfiguration : The type initializer for 'Microsoft.PowerShell.SecretStore.SecureStoreFile' threw an
exception.
At line:1 char:1
+ Get-SecretStoreConfiguration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretStoreConfiguration], TypeInitializationException
    + FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.SecretStore.GetSecretStoreConfig
   uration

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions