Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
When I install the Microsoft.PowerShell.SecretStore
extension vault module, Install-PSResource also tries to reinstall the Microsoft.PowerShell.SecretManagement
module that it depends on, even though the -Reinstall
parameter switch is not used.
However, the Microsoft.PowerShell.SecretManagement
module is currently loaded and so the reinstall fails because it is a binary cmdlet and the Microsoft.PowerShell.SecretManagement.dll
cannot be deleted.
The result is the Microsoft.PowerShell.SecretManagement
module is corrupted since all files are deleted except for the one binary.
I feel a reinstall operation should not occur unless specifically specified by the user. Also, and if a reinstall fails we should have a fallback that restores the original installation.
The corruption occurs without any user error, so it is not apparent that SecretManagement is broken until the user tries running one of its commands.
Expected behavior
PS C:\> Get-SecretInfo
Name Type VaultName
---- ---- ---------
Secret1 SecureString AzKeyVault
PS C:\> Install-PSResource -Name Microsoft.PowerShell.SecretManagement -Repository PSGallery -Scope AllUsers
PS C:\> Register-SecretVault -Name SecretStore -ModuleName Microsoft.PowerShell.SecretStore -AllowClobber
Actual behavior
PS C:\> Register-SecretVault -Name SecretStore -ModuleName Microsoft.PowerShell.SecretStore -AllowClobber
Register-SecretVault: Could not load and retrieve module information for module: Microsoft.PowerShell.SecretStore with error : The required module 'Microsoft.PowerShell.SecretManagement' is not loaded. Load the module or remove the module from 'RequiredModules' in the file 'C:\Program Files\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.5\Microsoft.PowerShell.SecretStore.psd1'..
Error details
Error occurs because all `Microsoft.PowerShell.SecretManagement` module files are deleted except for the binary file.
Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 3.0.11 beta powershellget {Find-PSResource, Get-Installed
Visuals
No response