0

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. Also how do I use markdown with powershell code like below on StackOverflow. I put it into code blocks but there is no syntax highlighting.

Configuration BasicIIS
{
    Import-DscResource -ModuleName 'PSDesiredStateConfiguration' 
    node localhost {
              ... Script etc logic which installed xWebAdministration Module
     }
}
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
Gregory Suvalian
  • 3,566
  • 7
  • 37
  • 66
  • you could probably try partial configurations for that – 4c74356b41 Apr 30 '17 at 12:15
  • Are you having trouble generating the MOF in the first place on an orchestrating machine, or processing it at the target due to the resource not being installed yet? – Matthew Wetmore Apr 30 '17 at 15:20
  • @MatthewWetmore This does not compile when being run on target machine, complaining that xWebAdministration module is not available – Gregory Suvalian Apr 30 '17 at 15:20
  • I don't think a partial config will solve the problem, but it's worth a shot. More likely you'll need to publish a secondary configuration (using either a push or pull) after the first has processed. Personally, I'd put the resources directly into the image offline before it ever booted/was deployed. – Matthew Wetmore Apr 30 '17 at 16:29

1 Answers1

0

Unless you are in a Pull scenario (such as Azure DSC) you will need to pre-load module requirements. The easiest way to do this is publish your modules somewhere (NuGet service or file share) and run PowerShellGet before applying the config, or embed them in the image if a truly offline requirement.