Parameterizing DSC configuration
As with functions, you can create configuration blocks with parameters. These enable you to produce different MOF files by varying the parameter values that are used when you execute the configuration.
For example, suppose you wanted to add a feature to a node. You could create a specific configuration where you hard code the feature name and the node name. This is not dissimilar to how you copied specific files from DC1
to SRV1
in the Using DSC and built-in resources recipe.
With parameterization, you create a configuration that takes the node name and the service name as parameters. When you run the configuration, PowerShell creates a MOF file that adds the specified service to the specified node. This recipe demonstrates that approach.
This approach throws up the problem that, by default, you can only send a single MOF file to a given node; therefore, if you used the earlier recipe and copied files to SRV2
, attempting to send a second MOF file to the system...