Powershell Module not loading even after the module path is defined in environment variables

environment-variables, powershell, powershell-3.0

Solution

I figured it out. I needed to add my mod.psm1 file to a folder named "mod". Now I can directly access my cmdlets write-hello or write-bye when i start PowerShell.

Problem

I have a module in a folder that I have created, C:\PowerShellScripts\Modules. I call this mod.psm1. This file contains two simple functions: Write-hello and Write-bye. Now, I have added this path(C:\PowerShellScripts\Modules) to my PSModulePath Environment variables path. Accordingly, this should auto load the module when I start PowerShell. Correct? But when I run PowerShell and try Write-hello or Write-bye it gives an error write-hello : The term 'write-hello' is not recognized as the name of a cmdlet, function, script file, or operable program PowerShell does not load the mod.psm1 file even though $ENV:PSModulePath shows my path (C:\PowerShellScripts\Modules) And I need to manually use Import-Module again. What could be wrong?

Original source