dsccommunity / dsccommunity/NetworkingDsc

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

Open
#416 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation
Dominant language
PowerShell
Stars
235
Forks
93
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the installed NetworkingDsc.psd1 at the reported module path and inspect how its ModuleVersion relates to the 7.3.0 folder. Reproduce with Test-ModuleManifest and Import-DscResource -ModuleName NetworkingDsc; done means the manifest validates and the module imports successfully on the reported PowerShell environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
infrastructure, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.