Problem with Import-Module

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 7 months ago.

  • Author
    Posts
  • #5275

    by iHunger at 2012-11-14 08:28:28

    I have several PowerShell Modules that are all named in the format OurCompanyName.Category. If I have only one of these in my modules directory I can use:

    ipmo OurComp*

    to import the module. If I have 2 or more I get an error reading:

    Import-Module : The specified module '*OurComp*' was not loaded because no valid module file was found in any module directory.
    At line:1 char:5
    + ipmo < <<< OurComp*
    + CategoryInfo : ResourceUnavailable: (OurComp*:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

    Additional details]
    These modules are written in C# and use a PSD1 manifest files. If we use the full names for the import-module cmdlet, the modules import fine, it is only when trying to use the wildcard to import them all.

    Anyone seen this before?

    by ArtB0514 at 2012-11-14 09:14:44

    Haven't tried to do this, but this should be a workaround for the issue:

    Get-Module OurComp* -ListAvailable | Import-Module

    by iHunger at 2012-11-15 06:38:48

    Thanks for the work-around. If I find the root cause I will post it here.

You must be logged in to reply to this topic.