Author Posts

September 13, 2016 at 3:29 am

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"

September 13, 2016 at 6:21 am

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

September 13, 2016 at 9:36 am

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

September 13, 2016 at 5:10 pm

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.

September 13, 2016 at 5:18 pm

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"}

September 13, 2016 at 11:37 pm

thank Nitin, using the powershell module syntax works