WMF4 to WMF5 Nested Config Problem

I have a nested config as such:

Configuration EventLogConfig
  ForEach ($Log in $EventLog)
      xWinEventLog $Log
        LogName            = $Log
        IsEnabled          = $true
        LogMode            = "Circular"
        MaximumSizeInBytes = 2048mb

Configuration DEVWebFarmIIS
    [string[]]$ComputerName = 'localhost'

  Node $ComputerName
          EventLog = "Application", "Security", "System"

If I execute this to create the MOF in WMF 4, it works fine (provided I have the modules in a location PowerShell can locate). However, If I switch over to a machine with WMF 5 it tells me that the xWinEventLog could not be loaded (I’ve made sure the module is in the Documents modules folder, Program Files, and even in the System32 modules directory). If I do an Import-DSCResource in the EventLogConfig configuration block, the DEVWebFarmIIS configuration block has no idea what methods are in the other config block. It tells me only DependsOn is available.

Did the syntax for doing nested configurations change? I’ve been trying to look it up with no luck.


This is more a “composite config,” and I’m not sure I realized that this worked in v4 the way you have it here. I’ve always created the “nested” configuration as a separate entity and set it up like a DSC Resource, and then called it from the “parent” configuration.

Thanks for the nested vs composite clarification :slight_smile:

I actually got the idea from the video Jeffery Snover did for the MVA (Getting Started with Desired State Configuration #6 starting at 24 minutes). He did it with Services, however. I’ve found it works fine with the “built-ins” in DSC…like the File resource or WindowsFeature resource. But, once I try it with one of the newer resources (like xWinEventLog or xWebsite) it works on v4, but not in v5 when generating the MOF.

If I run selection on just the EventLogConfig configuration block by itself, then do:

EventLogConfig -Logname "Application", "System"

I get the term xWinEventLog is not recognized as the name of a cmdlet error.

I tried doing the Import-DSCResource -Name “xWinEventLog” right above the param section in EventLogConfig configuration, but if I run the code above it tells me a LogNames parameter could not be found.

I’m going to try it from a fresh machine tomorrow and see. My system I’m running from it now is a brand new Surface Book with the module in Program Files and my Documents folder (as well as the modules directory under System32).