en-us/Writing_DSC_Configurations_with_cFg.walkthru.help.txt

<#
 
In addition to having tools to [Write DSC Resources](/Writing DSC Resources with cFg/), cFg also includes a few functions to help you create, slice, and dice DSC configurations.
 
They are:
* Out-Config
* Split-Config
* Join-Config
 
They're all fairly straightforward. Out-Config will take a number of input objects or hashtables, and use the information to create a DSC configuration.
#>
 
@{
    ResourceName = 'WindowsFeature'
    SettingName = 'IIS'
    Ensure = 'Present'
    Name = 'Web-Server'
}, @{
    ResourceName = 'Package'
    SettingName = 'UrlRewrite'
    Ensure = "Present"
    Name = "IIS URL Rewrite Module 2"
    Path = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
    Arguments = "/quiet"
    ProductId = "EB675D0A-2C95-405B-BEE8-B42A65D23E11"
} |
    Out-Config -Name IISInstall
 
<#
 
The ResourceName property indicates what DSC resource you'd like to use. The SettingName property indicates the name of the specific DSC setting. Any other properties in the object will be mapped to the appropriate parameters in the DSC resource.
 
Because Out-Config takes any type of object or hashtable, it's possible to store configuration settings in a database or file and use them on the fly. To import the configuration, simply use the dot operator on the result of Out-Config
     
#>
 
$config = @{
    ResourceName = 'WindowsFeature'
    SettingName = 'IIS'
    Ensure = 'Present'
    Name = 'Web-Server'
}, @{
    ResourceName = 'Package'
    SettingName = 'UrlRewrite'
    Ensure = "Present"
    Name = "IIS URL Rewrite Module 2"
    Path = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
    Arguments = "/quiet"
    ProductId = "EB675D0A-2C95-405B-BEE8-B42A65D23E11"
} |
    Out-Config -Name IISInstall
 
. $config
 
 
<#
 
Split-Config will split one configuration into several smaller configurations. This can be handy when you want to slice and dice parts of an existing configuration.
 
#>
 
$config | Split-Config
 
<#
 
Join-Config will join several configurations together. This can be useful when stitching the parts back together.
 
#>
 
 
$config | Split-Config | Join-Config -Name IISInstall