Skip to content

Get-SecretInfo: The specified module '...\Microsoft.PowerShell.SecretStore' was not loaded because no valid module file was found in any module directory. #217

@rkeithhill-keysight

Description

@rkeithhill-keysight

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

I'm not sure how to reproduce this since this only happens on my work PC which has redirected my ~\Document\PowerShell folder to a corporate OneDrive folder. SecretManagement/Store used to not give this error before my company forced this redirection. Note that the command still works but it is annoying getting this error spit out every time. Basically, all I have to do to get this error is:

  1. Start new PowerShell session
  2. Run Get-SecretInfo

I've tried preloading the modules and I still get this error:

image

The preloaded modules were loading from:

 > Get-Module *Secret* | Format-Table Name,Path  -AutoSize

Name                                  Path
----                                  ----
Microsoft.PowerShell.SecretManagement C:\Users\hillr\OneDrive - Keysight Technologies\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement\1.1.2\Microsoft.PowerShell.SecretManagement.dll
Microsoft.PowerShell.SecretStore      C:\Users\hillr\OneDrive - Keysight Technologies\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\Microsoft.PowerShell.SecretStore.dll

Finally, my $env:PSModulePath is set to:

> $env:PSModulePath -split ';'
C:\Users\hillr\OneDrive - Keysight Technologies\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\7\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files\Thycotic\Powershell\

I do not understand why there is an attempt to load from C:\Users\hillr\Documents\PowerShell\Modules\.

Expected behavior

I should see no error about the module file not being found.

Actual behavior

> Get-SecretInfo
Get-SecretInfo: The specified module 'C:\Users\hillr\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore' was not loaded because no valid module file was found in any module directory.
Vault PSUSecretStore requires a password.
Enter password:
***********

Name              Type         VaultName
----              ----         ---------
ApiDocsKey        String       PSUSecretStore

Error details

Exception             : 
    Type    : System.IO.FileNotFoundException
    Message : The specified module 'C:\Users\hillr\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore' was not loaded because no valid module file was found in any module directory.
    HResult : -2147024894
TargetObject          : C:\Users\hillr\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore
CategoryInfo          : ResourceUnavailable: (C:\Users\hillr\Docu…erShell.SecretStore:String) [Get-SecretInfo], FileNotFoundException
FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand
InvocationInfo        : 
    MyCommand        : Get-SecretInfo
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 3
    Line             : Get-SecretInfo
    Statement        : Get-SecretInfo
    PositionMessage  : At line:1 char:1
                       + Get-SecretInfo
                       + ~~~~~~~~~~~~~~
    InvocationName   : Get-SecretInfo
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 13
PipelineIterationInfo :

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

1.1.2

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions