1

I'm having an issue where the .mof file doesn't get generated when using a composite resource in it.The directory gets created fine and no errors are shown. It might be a simple issue to some fresh eyes, but I'm not seeing it :)

The composite resource gets recognized fine and as I said, no errors are shown. I'd appreciate any help!

Here are my configuration files:

composite resource

Configuration OfficeServer
{
    PARAM
    (
        [string]$IPAddress

    )

    Import-DscResource -Modulename XNetworking, PSDesiredStateConfiguration

    {

        xIPAddress IPAddress 
        {
            IPAddress = $IPAddress
            InterfaceAlias = "Ethernet"
            DefaultGateway = "192.168.10.1"
            SubnetMask = 24
            AddressFamily = "IPV4"
        }

        xDNSServerAddress DNSServer 
        {
            Address = "192.168.10.44"
            InterfaceAlias = "Ethernet"
            AddressFamily = "IPV4"
        }

    }

}

the configuration to generate the .mof

Configuration test
{

    Import-DscResource -modulename CommonConfig 

    Node localhost
    {
        OfficeServer test
        {
            IPAddress = "192.168.10.92"
        }

    }


}
SimonS
  • 11
  • 1
  • First, can you show us the folder structure of the module containing the composite config? Second, you might try making your `$IPAddress` parameter mandatory. I recall an issue I had with a custom resource where I couldn't use it properly without at least one mandatory/key parameter. – briantist Sep 17 '14 at 14:32
  • One other thing, show us how you're calling the config. After executing the `Configuration` *definition* you should then be calling the configuration as a function: `test -OutputPath .\put\mof\here` – briantist Sep 17 '14 at 17:40

1 Answers1

0

Thanks for the answers all, turned out I just had a pair of curly brackets too much in the composite resource. couldn't see it until I had some sleep :)

working version of the composite resource

Configuration OfficeServer
{
    PARAM
    (
        [string]$IPAddress

    )

    Import-DscResource -Modulename XNetworking, PSDesiredStateConfiguration



        xIPAddress IPAddress 
        {
            IPAddress = $IPAddress
            InterfaceAlias = "Ethernet"
            DefaultGateway = "192.168.10.1"
            SubnetMask = 24
            AddressFamily = "IPV4"
        }

        xDNSServerAddress DNSServer 
        {
            Address = "192.168.10.44"
            InterfaceAlias = "Ethernet"
            AddressFamily = "IPV4"
        }



}
simons
  • 1
  • 1