psm1 file not recognized by Import-Module

Welcome Forums General PowerShell Q&A psm1 file not recognized by Import-Module

This topic contains 2 replies, has 2 voices, and was last updated by

3 years, 7 months ago.

  • Author
  • #25628

    Points: 0
    Rank: Member

    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

    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    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

    Points: 0
    Rank: Member

    Thanks Don, absolutly correct, it is working now

The topic ‘psm1 file not recognized by Import-Module’ is closed to new replies.