title: Why can't I get my modules to load from a directory in PSModulePath?
body: <p>I'm trying to install a PS module so that it can be imported from anywhere. I've added my install directory to the environment variable and that didn't work, so I tried putting my module in the PSCX directory since I know that one works. Below is the command line history that demonstrates the problem. Why doesn't "import-module foo" work here?</p>
  
  <pre><code>C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx&gt; $env:PSModulePath
  C:\Users\chris\Documents\WindowsPowerShell\Modules;C:\Program Files (x86)\PowerShell     Community Extensions\Pscx3\;C:\windows\system32\WindowsPowerShell\v1.0\Modules\
  
  # There's my module; foo.psm1
  C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx&gt; dir *.psm1
  
  
      Directory: C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx
  
  
  Mode           LastWriteTime       Length Name
  ----           -------------       ------ ----
  -a---     3/28/2013 10:37 AM           44 foo.psm1
  -a---    10/20/2012  8:52 PM        19658 Pscx.psm1
  
  
  # this works, as expected, so my PSModulePath seems correct.
  C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx&gt; import-module -force pscx
  
  # I expect this to work since the module is in a PSModulePath directory... but it doesn't
  C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx&gt; import-module foo
  import-module : The specified module 'foo' was not loaded because no valid module file was found in any module directory.
  At line:1 char:1
  + import-module foo
  + ~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ResourceUnavailable: (foo:String) [Import-Module], FileNotFoundException
      + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
  
  # Try again with the extension... nope.
  C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx&gt; import-module foo.psm1
  import-module : The specified module 'foo.psm1' was not loaded because no valid module file was found in any module directory.
  At line:1 char:1
  + import-module foo.psm1
  + ~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ResourceUnavailable: (foo.psm1:String) [Import-Module], FileNotFoundException
      + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
  
  # I can import the module if I give the path
  C:\Program Files (x86)\PowerShell Community Extensions\pscx3\Pscx&gt; import-module ./foo.psm1 -verbose:$true
  VERBOSE: Importing function 'fooobar'.
  </code></pre>