How do I compile DSC to MOF if required module is not yet available

I need to use module xWebAdministration in my DSC Configuration but this module is not yet installed in system and being installed in Configuration preceding current one. Example is below.

Configuration BasicIIS
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration' 
    node localhost {
              ... Script etc logic which installed xWebAdministrationModule
BasicIIS -OutputPath .\BasicIIS
Start-DscConfiguration -Wait -Verbose -Path .\BasicIIS -Force
Configuration SecondStep
    Import-DSCResource -moduleName "xWebAdministration"
    xWebSiteDefaults DefaultConfig {
        ApplyTo = "Machine"
        LogDirectory = "c:\inetpub\logs\LogFiles\host"
        TraceLogDirectory = "c:\inetpub\logs\LogFiles\host\FREB"
SecondStep -OutputPath .\BasicIIS
Start-DscConfiguration -Wait -Verbose -Path .\BasicIIS -Force


It depends on your setup. I wouldn’t use to install your DSC Resources. If you are using the PULL model, then you would have to zip your DSC Resource Modules in a specific way and place them on the DSC Pull Server ‘C:\Program Files\WindowsPowerShell\DscService\Modules’. When a client pulls its configuration, it will automatically download any DSC resource modules it requires to execute the .mof. Check out this URL for details:

If you are using a PUSH model, then I would recommend you to ensure that the necessary DSC resources are already in place prior to executing your Configuration. That is what I did.

Good luck,

If the 2nd step is failing check that the 1st step has installed the DSC resources correctly by running get-dscresource on that node. If this does not return “xWebAdministration” then part one has failed.