Import-Module works only when piped from Get-Module
问题 I wrote a simple PowerShell module. I need to keep more versions of the module. All paths to versions are added to $env:PSModulePath . I'm facing strange problem when importing the module to my session. This fails: Import-Module Contoso.PowerShell -RequiredVersion "0.0.2" Import-Module : The specified module 'Contoso.PowerShell' with version '0.0.2' was not loaded because no valid module file was found in any module directory. At line:1 char:1 + Import-Module Contoso.PowerShell