Import-DscResource -ModuleVersion not obey

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Tim Ker Tim Ker 2 months, 2 weeks ago.

  • Author
    Posts
  • #54079
    Profile photo of Tim Ker
    Tim Ker
    Participant

    moduleVersion does not seems to be doing anything (WMF 5)

    code
    ensure two versions of the same module is installed

      Install-Module xWebAdministration -Version 1.13.0.0
      Install-Module xWebAdministration -RequiredVersion 1.11.0.0
    

    run this basic dsc config

    
    Configuration TestDSCVersion {
        
       Import-DscResource  -ModuleName  xWebAdministration -ModuleVersion 1.11.0.0
    
        node ("localhost")
        {
    
            xWebAppPool ScooplaApplicationPool
            {
                Ensure = 'Absent'
                Name =   "asdfasdf"
            }
    
        }
      }
    
    
    TestDSCVersion
    
    

    the output of the mof file is:

    
    
    instance of MSFT_xWebAppPool as $MSFT_xWebAppPool1ref
    {
    ResourceID = "[xWebAppPool]ScooplaApplicationPool";
     Ensure = "Absent";
     SourceInfo = "C:\\Dev\\Scoopla.Dev\\ModuleVersion.ps1::14::5::xWebAppPool";
     Name = "asdfasdf";
     ModuleName = "xWebAdministration";
     ModuleVersion = "1.13.0.0";
    
     ConfigurationName = "TestDSCVersion";
    
    };
    
    

    ModuleVersion = "1.13.0.0"; instead of ModuleVersion = "1.11.0.0"

  • #54080
    Profile photo of Arie H
    Arie H
    Participant

    Can you run Get-Module and see both versions are indeed showing ?
    Also, can you show the exact version of ps you have?

  • #54085
    Profile photo of Tim Ker
    Tim Ker
    Participant

    Major Minor Build Revision
    —– —– —– ——–
    5 0 10586 117

    Yes both versions are definitely installed.

    ModuleType Version Name ExportedCommands
    ———- ——- —- —————-
    Manifest 1.13.0.0 xWebAdministration
    Manifest 1.11.0.0 xWebAdministration

  • #54128
    Profile photo of Nitin Gupta
    Nitin Gupta
    Participant

    I will check on 5.0 version of Powershell soon. However on 5.1 I get the expected result with ModuleVersion = 1.11.0.0 in localhost.mof file.

  • #54129
    Profile photo of Nitin Gupta
    Nitin Gupta
    Participant

    Yes I see that issue on PS version 5.0. However, the following syntax works:

    Import-DscResource  -ModuleName  @{moduleName="xWebAdministration";requiredversion="1.11.0.0"}
    
  • #54141
    Profile photo of Tim Ker
    Tim Ker
    Participant

    thank Nitin, using the powershell module syntax works

You must be logged in to reply to this topic.