Compiling DSC configurations using ConfigurationIDs

To register target nodes with the DSC pull server, we assign ConfigurationIDs to each target node's LCM and then name the MOF file with the same ConfigurationID. We already registered the ConfigurationID with the target node by setting it in the LCM configuration block earlier in the chapter. We now have to rename the MOF file with the ConfigurationID and place it in the DSC pull server directory:

$outputPath = ([IO.Path]::Combine($PSScriptRoot, 'SetupTheSite'))
$dataScript = ([IO.Path]::Combine($PSScriptRoot, 'https_config_data.ps1'))
$configData = &$dataScript
    
c:vagrantookch06example_configuration.ps1 -outputPath $outputPath -configData $configData | Out-Null
    
Rename-Item -Path (Join-Path $($outputPath) 'dsc-box2.mof') `
-NewName 'c19fbe22-b664-4a8a-a2a1-477f16ce9659.mof'

In your production scripts, you could place the ConfigurationID in the NodeName field instead of the name of the node. This will cause the resulting MOF file to be automatically named with the ConfigurationID. We chose not to do this in the example in order to have the least number of changes in the data file in the examples.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset