0

Having a hell of a time with this! Powershell v4 cant find the MyModule module, I've tried it in all the $env:PSModulePath locations, including adding my, I've tried the -refresh parameter on get-module... nothing, any ideas?

PS Scripts:\> gci C:\Users\lgriffith\Documents\WindowsPowerShell\Modules\MyModule


    Directory: C:\Users\lgriffith\Documents\WindowsPowerShell\Modules\MyModule


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        17/12/2014     13:36       1601 Luke-Module.psm1


PS Scripts:\> Get-Module -ListAvailable


    Directory: C:\Users\lgriffith\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4        ShowUI                              {Get-ApplicationCommand, Get-Component...


    Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.0.0    AppLocker                           {Set-AppLockerPolicy, Get-AppLockerPol...
Manifest   1.0.0.0    BitsTransfer                        {Add-BitsFile, Remove-BitsTransfer, Co...
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimCla...
Script     1.0.0.0    ISE                                 {New-IseSnippet, Import-IseSnippet, Ge...
Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Cou...
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Ite...
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate,...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Ta...
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCre...
Binary     1.0        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Sta...
Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombi...
Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remov...
Manifest   2.0.0.0    PSWorkflow                          {New-PSWorkflowExecutionOption, New-PS...
Manifest   1.0.0.0    PSWorkflowUtility                   Invoke-AsWorkflow
Manifest   1.0.0.0    TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-Troub...


PS Scripts:\> ipmo MyModule
ipmo : The specified module 'MyModule' was not loaded because no valid module file was found in
any module directory.
At line:1 char:1
+ ipmo MyModule
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (MyModule:String) [Import-Module], FileNotFound
   Exception
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCom
   mand

1 Answer 1

1

The name of the module file has to match the name of the directory it's stored under.

For example,

C:\Users\lgriffith\Documents\WindowsPowerShell\Modules\MyModule\Luke-Module.psm1

is invalid, while

C:\Users\lgriffith\Documents\WindowsPowerShell\Modules\MyModule\MyModule.psm1

should work.

Sign up to request clarification or add additional context in comments.

1 Comment

I'll give this a go tomorrow. Thanks for your reply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.