Author Posts

May 26, 2015 at 9:47 am

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

[blockquote]C:\Users\myuser.domain\Documents\WindowsPowerShell\Modules
[/blockquote]
I double checked my $env:psmodulepath, it contains 4 paths, one of them the one mentioned above.
[blockquote]C:\Users\myuser.domain\Documents\WindowsPowerShell\Modules\
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
C:\Program Files [x86]\Microsoft SQL Server\120\Tools\PowerShell\Modules\
[/blockquote]
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

May 26, 2015 at 9:55 am

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

...\Modules\MyModule\MyModule.psm1

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

May 26, 2015 at 10:16 am

Thanks Don, absolutly correct, it is working now