Author Posts

July 24, 2017 at 8:17 pm

I have 2 different DSC configurations I want to apply to one server. One is for SQL, the second is to install Docker. I've run both scripts successfully individually and have run test-dscconfiguration against both configurations successfully. The problem is getting "reporting" from the server on both configurations in one test-configuration, as test-configuration only reports on the last .mof file applied. I was hoping to enable reporting on everything applied by DSC by using Partial Configurations. I would combine multiple DSC configurations from multiple scripts in one, then run a test-dscconfiguration against the merged .mof, as follows:

$nodelist = get-content 'dscconfig_verify_sql-docker_sqlnodelist.txt'
configuration PartialConfigDemo
    Node localhost #$node #localhost
        PartialConfiguration ConfigDSC_SQLNodes_Serial
            Description = "Configuration to install SQL Server."
            RefreshMode = 'Push'
        PartialConfiguration DSC_Install_Docker
            Description = "Configuration to install Docker"
            RefreshMode = 'Push'

foreach ($node in $nodelist)
    $AdminCredential = Get-Credential -username mydomain\myuserid -message "Enter an Admin ID for $node"
    #$cimsession = ''
    $cimsession = new-cimsession -credential $AdminCredential -computername $Node
    Get-DscLocalConfigurationManager -cimsession $cimsession
    pause # this next line is necessary to tell the LCM on the receiving node that you're sending it a new metaconfig.mof related to partial configurations.
    #Set-DscLocalConfigurationManager -Path "c:\program files\windowspowershell\dscservice\configuration\partialconfigdemo" -cimsession $cimsession -verbose
    Publish-DscConfiguration -computername $node -Credential $AdminCredential -path "c:\program files\windowspowershell\dscservice\configuration\ConfigDSC_SQLNodes_Serial" -force -Verbose
    write-output "Just pushed SQL Configuration MOF to \\$node\c$\windows\system32\configuration\partialconfigurations"
    Publish-DscConfiguration -computername $node -credential $AdminCredential -path "c:\program files\windowspowershell\dscservice\configuration\DSC_Install_Docker" -Force -Verbose
    write-output "Just pushed Docker Configuration MOF to \\$node\c$\windows\system32\configuration\partialconfigurations"
    #Start-DSCConfiguration -UseExisting -computername $node -credential $admincredential -Wait -Force -Verbose
    Get-DscConfigurationstatus -CimSession $cimsession | select pscomputername,startdate,type,status,mode,numberofresources | format-table
    (test-dscconfiguration -detailed -cimsession $cimsession).resourcesindesiredstate | select pscomputername,ResourceID,InDesiredState | format-table -autosize
    (test-dscconfiguration -detailed -cimsession $cimsession).resourcesnotindesiredstate | select pscomputername,ResourceID,InDesiredState | format-table -autosize

# for reference: remove-dscconfigurationdocument -stage (pending, previous, current) -CimSession $cimsession -force
I have the destination node's c:\windows\system32\configuration directory open in another window to watch what happens. The .mofs are created, the partialconfigurations directory contents changes/is updated, but I get this error: 

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = ApplyConfiguration,'className' =
MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer SE131346 with user sid S-1-5-21-4278529026-3823030349-3524473939-155576.
VERBOSE: [SE132476]:                            [] Starting consistency engine.
The resources ('[WindowsFeature]DSCService' and '[WindowsFeature]DSCService') have conflicting values of the following properties: 'ModuleVersion'. Ensure that their values match.  Merging of partial configurations failed. LCM failed to start desired
state configuration manually.
    + CategoryInfo          : ResourceExists: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 11
    + PSComputerName        : se132476

In both of my separate DSC scripts (sql and docker), I have  

WindowsFeature DSCService 
            Name    = "DSC-Service"
            Ensure  = "Present"

I was under the impression from research, that including identically configured resources would work, but even after commenting out that feature, I get the same error. 

Does anyone have any advice on what this error means, or on implementing partial configurations to resolve this issue?

July 24, 2017 at 8:43 pm

Magazines have issues. You have a problem.

Partial configurations aren't quite the same as "combining multiple DC configurations from multiple scripts;" each partial is a complete and total configuration MOF, and the node simply applies them all. They are a huge PITA; see "The DSC Book" for other options. Like, pushing multiple partials is permitted, but it's going to make reporting a little weird. I might, for example, create my two chunks as "fragments" which get dot-sourced into a single actual script, thereby producing one MOF while still keeping each chunk "separated" into individual files.

Anyway, the error you're running into is exactly why Partials are a PITA. The deal is, no matter how many partials you push, none of them can contain a duplicate key value. You don't know you've done this until the LCM evaluates everything, unless you're super-careful. In your specific case, you have the duplicate key value "DSC-Service" for WindowsFeature, and that is illegal. The LCM will hate you forever; what you're doing is not supported.

July 24, 2017 at 10:24 pm


I completely deleted the feature setting from both of the individual scripts, along with all the .mof files on the destination node. but the error persists, in the same format, which I thought would've changed to match my change in the individual scripts. I mean originally, the first times I ran each of the individual scripts, I had this "WindowsFeature DSCService", but I changed "WindowsFeature DSCService" to "WindowsFeature DSC-Service" to see if the error would change, but it hasn't. Now, I've completely removed the entire feature setting from both scripts, with no change in the error. This leads me to believe something from the earlier iterations is buried somewhere on the machine. Do you have any idea where?

I do have all 3 of my test servers checkpointed to before the sql and docker dsc configs. I guess it's time to revert them and start over. I'll try your dot sourcing recommendation.

July 24, 2017 at 10:26 pm

Yeah, we documented the "where" in good detail in The DSC Book (heartily recommended). But start with Remove-DscConfiguration. It's got parameters to remove the various copies the LCM keeps.

July 24, 2017 at 11:56 pm

I did purchase your DSC book a couple months ago. Does the same absolute rule of no duplicated resources apply if I use dot-sourcing of "thin" DSC scripts?

July 25, 2017 at 4:45 pm

You can solve this problem by explicitly specifying import-DscResource for 'PsDesiredStateConfiguration' module in both the configurations with the specific version of the module (1.1).

Import-DscResource -ModuleName 'PsdesiredStateConfiguration' -ModuleVersion 1.1