PowerShell / Modules

MIT License
111 stars 25 forks source link

Secret Management module will not import on Windows Server 2016 #80

Closed dloder0 closed 4 years ago

dloder0 commented 4 years ago

Steps to reproduce

Fresh install of Server 2016, fully patched via Windows Update Install current PSGet As Administrator:

Install-Module PowerShellGet -RequiredVersion 2.2.4.1 -SkipPublisherCheck

Install current PSSecretMgmt module As Administrator Restart PS so new PSGet is active

PS C:\Users\Administrator> Install-Module Microsoft.PowerShell.SecretManagement -AllowPrerelease

Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y PS C:\Users\Administrator> Get-SecretVault Get-SecretVault : The 'Get-SecretVault' command was found in the module 'Microsoft.PowerShell.SecretManagement', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.SecretManagement'. At line:1 char:1

PS C:\Users\Administrator> Import-Module Microsoft.PowerShell.SecretManagement Import-Module : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. At line:1 char:1

Expected behavior

Module can import on WS2016

Actual behavior

Module fails to import

Environment data

This fails on all my 2016 servers

Module version:

PS C:\Users\Administrator> $psversiontable

Name Value


PSVersion 5.1.14393.3471 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.14393.3471 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

PS C:\Users\Administrator> get-module -ListAvailable -Name Microsoft.PowerShell.SecretManagement

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Binary 0.2.1 Microsoft.PowerShell.SecretManag... {Register-SecretVault, Unregister-SecretVault

mivalsten commented 4 years ago

This module requires PowerShell Core Check this file, line 13. https://github.com/PowerShell/Modules/blob/master/Modules/Microsoft.PowerShell.SecretManagement/src/Microsoft.PowerShell.SecretManagement.psd1

You can get newest stable PSCore version here: https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0

dloder0 commented 4 years ago

That's really weird behavior and an error message that does not point to the real problem. The module installs and imports on WS2012R2 with WMF 5.1 and on WS2019. It was only WS2016 that was failing. Maybe some of the documentation needs to point to this requirement.

JustinGrote commented 4 years ago

@dloder0 just a reminder this is in an experimental preview state, the error messages and compatibility will be firmed up down the road.

Further, I don't think it will be a hard requirement for PS Core, 5.1 compatibility just hasn't been addressed yet but I've already got a couple issues out there that make it work once the team fixes them.