Import-DscResource -ModuleVersion not obey

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

ensure two versions of the same module is installed

  Install-Module xWebAdministration -Version
  Install-Module xWebAdministration -RequiredVersion

run this basic dsc config

Configuration TestDSCVersion {
   Import-DscResource  -ModuleName  xWebAdministration -ModuleVersion

    node ("localhost")

        xWebAppPool ScooplaApplicationPool
            Ensure = 'Absent'
            Name =   "asdfasdf"



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 = "";

 ConfigurationName = "TestDSCVersion";


ModuleVersion = “”; instead of ModuleVersion = “”

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

Major Minor Build Revision

5 0 10586 117

Yes both versions are definitely installed.

ModuleType Version Name ExportedCommands

Manifest xWebAdministration
Manifest xWebAdministration

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

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

Import-DscResource  -ModuleName  @{moduleName="xWebAdministration";requiredversion=""}

thank Nitin, using the powershell module syntax works