psm1 file not recognized by Import-Module

This topic contains 2 replies, has 2 voices, and was last updated by  Salam Elias 3 years ago.

  • Author
  • #25628

    Salam Elias

    Hi, I started to experiment the modules in powershell, created a very basic Greetings.psm1 one and placed it in

    I double checked my $env:psmodulepath, it contains 4 paths, one of them the one mentioned above.
    C:\Program Files\WindowsPowerShell\Modules
    C:\Program Files [x86]\Microsoft SQL Server\120\Tools\PowerShell\Modules\
    Doing a

    Get-Module -ListAvailable
    PS lists all modules in the 3rd and 4rth directories but not the psm1 found in my user powershell directory Is there any specific config needs to be done in order to make the module available apart from dropping it in one of the directories (I even dropped it in C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ it did not show neither

    Thanks for your help

  • #25629

    Don Jones

    The .psm1 can't go into the \Modules folder. You need to create a subfolder.


    The subfolder name and .psm1 filename (e.g., "MyModule") must match.

  • #25631

    Salam Elias

    Thanks Don, absolutly correct, it is working now

You must be logged in to reply to this topic.