Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkingDsc: "Import-DscResource Could not find the module" due to ModuleVersion Key not matching Folder Directory #416

Open
WMPCraig opened this issue Aug 29, 2019 · 4 comments
Labels
needs investigation The issue needs to be investigated by the maintainers or/and the community.

Comments

@WMPCraig
Copy link

ISSUE DESCRIPTION

I am able to Install-Module successfully. However when try to Import-DSC Resource within my configuration PowerShell shows an error "Could not find the module 'NetworkingDsc'

When running Test-ModuleManifest there is an issue with the ModuleVersion Key not matching the folder name

Test-ModuleManifest : The ModuleVersion key in module manifest 'C:\Program Files\WindowsPowerShell\Modules\NetworkingDsc\7.3.0\NetworkingDsc.psd1' specifies module version '7.3.0.0' which does not match its version folder name at 'C:\Program
Files\WindowsPowerShell\Modules\NetworkingDsc\7.3.0'. Change the value of the ModuleVersion key to match the version folder name.
At line:1 char:1

  • Test-ModuleManifest -Path "C:\Program Files\WindowsPowerShell\Modules ...
  •   + CategoryInfo          : InvalidArgument: (C:\Program File...workingDsc.psd1:String) [Test-ModuleManifest], InvalidOperationException
      + FullyQualifiedErrorId : Modules_InvalidModuleManifestVersion,Microsoft.PowerShell.Commands.TestModuleManifestCommand
    
    

Details of the scenario you tried and the problem that is occurring

Verbose logs showing the problem

Install-Module NetworkingDsc -Repository WMP_Share -Force -Verbose

VERBOSE: InstallPackageLocal' - name='NetworkingDsc', version='7.3.0',destination='C:\Users\USR _Name\AppData\Local\Temp\1411520941'
VERBOSE: Catalog file 'NetworkingDsc.cat' is not found in the contents of the module 'NetworkingDsc' being installed.
VERBOSE: Module 'NetworkingDsc' was installed successfully to path 'C:\Program Files\WindowsPowerShell\Modules\NetworkingDsc\7.3.0'.

At line:8 char:5

  • Import-DscResource -ModuleName NetworkingDsc
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Could not find the module 'NetworkingDsc'.

Suggested solution to the issue

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# insert configuration here
configuration DevAMQ
{
    #Import-DscResource -ModuleName PSDscResources
    Import-DscResource -ModuleName xPSDesiredStateConfiguration 
    Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
    Import-DscResource -ModuleName P_ArtemisMQ_Build
    Import-DscResource -ModuleName P_RedHat_Fuse
    Import-DscResource -ModuleName NetworkingDsc


    node $AllNodes.NodeName
    {
        # Set LCM to reboot if needed
        LocalConfigurationManager
        {
            RebootNodeIfNeeded = $false
        }

## Install .Net3.5!!
        WindowsFeature DotNet3.5
        {
            Ensure = "Present"
            Name = "NET-Framework-Features"
            Source = $node.dotNETSource
        }

       Package JavaInstaller
        {
            Ensure          = "Present"
            Name            = $node.JavaName
            Path            = $node.JavaSource
            Arguments       = 'InstallDir="'+$($AllNodes.JavaInstDir)+'\'+$($AllNodes.JavaName)+'"'
            ProductId       = ''
            DependsOn       = "[WindowsFeature]DotNet3.5"
            
        }
        
        xEnvironment Java_Home
        {
            Name   = 'Java_Home'
            Value  = "$($AllNodes.JavaInstDir)\$($AllNodes.JavaName)"
            Ensure = 'Present'
            Path   = $false
            DependsOn = "[Package]JavaInstaller"
        }

        Environment CamelEnc
        {
            Name   = 'CAMEL_ENCRYPTION_PASSWORD'
            Value  = '5eCret'
            Ensure = 'Present'
            Path   = $false
        }


        File CopyArtemisInstaller
        {
            Ensure = "Present"
            Type = "Directory"
            Recurse = $true
            SourcePath = $AllNodes.ArtemisSource
            DestinationPath = $node.AMQ_InstallDir
        }
        
        ArtemisMQ Broker
        {
            Ensure = "Present"
            InstallDirectory = $node.AMQ_BrokerInst
            HostName = "AMQ_$($Node.NodeName)"
            NodeName = $Node.NodeName
            NodeRole = $Node.AMQ_NodeRole
            User = $node.AMQ_User
            UserPassword = $node.AMQ_UserPassword
            ActiveMQInstaller = "$($node.AMQ_InstallDir)\bin\artemis.cmd"
            ClusterUser = $AllNodes.ClusterUser
            ClusterPassword = $AllNodes.ClusterPassword
            ClusterName = $AllNodes.ClusterName
            HAMode = $AllNodes.HAMode
            DependsOn = "[Package]JavaInstaller","[File]CopyArtemisInstaller"
        }

        RedHat_Fuse Primary
        {
            Ensure = 'Present'
            InstallMedia = $AllNodes.FuseSource
            InstallDir = $Node.Fuse_InstallDir
            FuseInstance = $Node.Fuse_Instance
            JavaMin = $node.JavaMin
            JavaMax = $node.JavaMax
            FuseUsers = ConvertTo-Json -InputObject $FuseUsers
            DependsOn = "[Package]JavaInstaller"
        }

        Firewall Fuse_HawtIO
        {
            Name                  = 'NotePadFirewallRule'
            DisplayName           = 'Firewall Rule for Notepad.exe'
            Ensure                = 'Present'
            Enabled               = 'True'
            Profile               = ('Domain', 'Private')
            Direction             = 'OutBound'
            RemotePort            = ('8080', '8081')
            LocalPort             = ('9080', '9081')
            Protocol              = 'TCP'
            Description           = 'Firewall Rule for Notepad.exe'
            Program               = 'c:\windows\system32\notepad.exe'
        }

    }
}

#### The operating system the target node is running
OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1903
WindowsBuildLabEx    : 18362.1.amd64fre.19h1_release.190318-1202
OsLanguage           : en-US
OsMuiLanguages       : {en-US, en-GB, si-lk}

#### Version and build of PowerShell the target node is running
Name                           Value                                                                                                                                                                                                                 
----                           -----                                                                                                                                                                                                                 
PSVersion                      5.1.18362.145                                                                                                                                                                                                         
PSEdition                      Desktop                                                                                                                                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                               
BuildVersion                   10.0.18362.145                                                                                                                                                                                                        
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                       
WSManStackVersion              3.0                                                                                                                                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                   
SerializationVersion           1.1.0.1   

#### Version of the DSC module that was used ('dev' if using current dev branch)
7.3.0
@WMPCraig WMPCraig changed the title NetworkingDsc: Import-DscResource Could not find the module NetworkingDsc: "Import-DscResource Could not find the module" due to ModuleVersion Key not matching Folder Directory Aug 29, 2019
@johlju
Copy link
Member

johlju commented Aug 29, 2019

Are you getting the module from an internal repository? If so then this might track this problem. PowerShell/DscResources#508

@PlagueHO PlagueHO added the needs investigation The issue needs to be investigated by the maintainers or/and the community. label Aug 30, 2019
@WMPCraig
Copy link
Author

@johlju I am getting it from our internal repo. Is this the issue or will it be the same from PS Gallery?

@johlju
Copy link
Member

johlju commented Aug 30, 2019

If you use install-module from the gallery you should not see this issue.

@PlagueHO
Copy link
Member

FYI: If you're using something like Sonatype Nexus, using a Proxy repository of PSGallery will work just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation The issue needs to be investigated by the maintainers or/and the community.
Projects
None yet
Development

No branches or pull requests

3 participants