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

Welcome Forums DSC (Desired State Configuration) How do I compile DSC to MOF if required module is not yet available

This topic contains 2 replies, has 3 voices, and was last updated by

 
Participant
1 year, 6 months ago.

  • Author
    Posts
  • #69825
    GS

    Participant
    Points: 1
    Rank: Member

    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
    
  • #69975

    Participant
    Points: 0
    Rank: Member

    Hi,

    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: https://msdn.microsoft.com/en-us/powershell/dsc/pullserver

    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,
    -Michael

  • #70424

    Participant
    Points: 56
    Rank: Member

    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.

The topic ‘How do I compile DSC to MOF if required module is not yet available’ is closed to new replies.