PowerShell / SecretManagement

PowerShell module to consistent usage of secrets through different extension vaults
MIT License
335 stars 47 forks source link

.NET Requirements? #141

Closed SwarfegaGit closed 3 years ago

SwarfegaGit commented 3 years ago

I have just installed the module on a Windows 2012 R2 Server using Windows PowerShell 5.1 but it throws this error. After a quick search, I believe it's down to running an older version of .NET Framework?

PS C:\Users\MyUser> Get-SecretVault
Get-SecretVault : Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)'.
At line:1 char:1
+ Get-SecretVault
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretVault], MissingMethodException
    + FullyQualifiedErrorId : System.MissingMethodException,Microsoft.PowerShell.SecretManagement.GetSecretVaultCommand

PS C:\Users\MyUser> reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full" /v version

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full
    version    REG_SZ    4.5.51641

Is this the case? What are the version requirements for this module?

I have PowerShell 7.1.3 also installed on the server and unsurprisingly it works fine with this version.

PaulHigin commented 3 years ago

SecretManagement is built against the net461 framework and PowerShell standard library 5.1.0.

ThomasNieto commented 3 years ago

@PaulHigin since that is the case can you please add the DotNetFrameworkVersion key in the module manifest?

PaulHigin commented 3 years ago

Will do.

wsmelton commented 3 years ago

Adding this for those finding this as well @SwarfegaGit

While it is supported on Windows PowerShell 5.1, the dependency of .NET has an effect as well. The .NET 4.6.1 framework is only found by default on Windows Server 2016+, so using Server 2012/R2 will mean you have to install that version of .NET to use the module. PowerShell 7 packages the .NET runtime with it so it does not have that OS level dependency.

You can see the default .NET frameworks by OS here: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies

PaulHigin commented 3 years ago

Added info to manifest.