Powershell: Error when importing module


  • Hi,

    I am trying to install and import the following module:

    I followed the instructions and save the contents into a .psm1 file, and put it into a sub-directory in my %home%\documents\windowspowershell\modules

    However when I try to import the module by the name that I gave it (dhcp.psm1), I get the following error:

    Import-Module : The specified module 'dchp.psm1' was not loaded because no valid module file was found in any module directory.
    At line:1 char:14
    + Import-Module <<<<  dchp.psm1
        + CategoryInfo          : ResourceUnavailable: (dchp.psm1:String) [Import-Module], FileNotFoundException
        + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand


    If I run the Get-Module -ListAvailable, I get the following output:

    ModuleType Name                      ExportedCommands                                                          
    ---------- ----                      ----------------                                                          
    Script     dhcp                      {}                                                                        
    Script     DotNet                    {}                                                                        
    Manifest   FileSystem                {}                                                                        
    Manifest   IsePack                   {}                                                                        
    Manifest   PowerShellPack            {}                                                                        
    Manifest   PSCodeGen                 {}                                                                        
    Manifest   PSImageTools              {}                                                                        
    Manifest   PSRSS                     {}                                                                        
    Manifest   PSSystemTools             {}                                                                        
    Manifest   PSUserTools               {}                                                                        
    Manifest   TaskScheduler             {}                                                                        
    Manifest   WPK                       {}                                                                        
    Manifest   AppLocker                 {}                                                                        
    Manifest   BitsTransfer              {}                                                                        
    Manifest   PSDiagnostics             {}                                                                        
    Manifest   TroubleshootingPack       {}     


    I am able to import all the other modules successfully.  I've never done this before, so I sure I'm doing something wrong.

    Tuesday, August 16, 2011 12:49 PM


All replies