Author Posts

September 8, 2015 at 5:02 am

I've started testing WMF 5 Production Preview against my DSC config that works perfectly with WMF 5 April Preview. To cut a long story short I can no longer apply partial DSC config to a node. Any one of the following errors can appear:

The resource PSDesiredStateConfiguration from module MSFT_FileDirectoryConfiguration is imported twice using
version 1.0 and version 0.0. Using more than one version of a resource is not supported. Remove one of the
versions to correct the problem.

The resource PSDesiredStateConfiguration from module MSFT_RoleResource is imported twice using version 0.0 and version 1.0. Using more than one version of a resource is not supported. Remove one of the versions to correct the problem.

The resource PSDesiredStateConfiguration from module MSFT_ScriptResource is imported twice using version 0.0 and version 1.0. Using more than one
version of a resource is not supported. Remove one of the versions to correct the problem.

I've created some proof of concept code to show how the error can be generated.

——— LCMConfig.ps1 snip ————-

[DSCLocalConfigurationManager()]
Configuration LCMConfig
{
param
(
[Parameter(Mandatory = $True)]
[string]$ComputerName,

[Parameter(Mandatory = $True)]
[string]$PullServer,

[Parameter(Mandatory = $True)]
[string]$GUID
)

Node $ComputerName {

Settings {
RefreshMode = "Pull"
ConfigurationID = $GUID
RebootNodeIfNeeded = $True
}

ConfigurationRepositoryWeb DSCHTTP {
ServerURL = "http://$($PullServer):8080/PSDSCPullServer.svc"
AllowUnsecureConnection = $True
}

PartialConfiguration PartConfig1
{
Description = 'Test description'
ConfigurationSource = '[ConfigurationRepositoryWeb]DSCHTTP'
}

PartialConfiguration PartConfig2
{
Description = 'Test description'
ConfigurationSource = '[ConfigurationRepositoryWeb]DSCHTTP'
DependsOn = '[PartialConfiguration]PartConfig1'
}
}
}

——— LCMConfig.ps1 snip ————-

——— PartConfig.ps1 snip ————-

configuration PartConfig1
{
Import-DscResource –ModuleName PSDesiredStateConfiguration

node ("PartConfig1.$GUID")
{
File FriendlyName1
{
Ensure = 'Present'
DestinationPath = 'C:\PartConfig1.txt'
Type = 'File'
}
}
}

configuration PartConfig2
{
Import-DscResource –ModuleName PSDesiredStateConfiguration

node ("PartConfig2.$GUID")
{
File FriendlyName2
{
Ensure = 'Present'
DestinationPath = 'C:\PartConfig2.txt'
Type = 'File'
}

Script WDSAnswerPolicy {
PsDscRunAsCredential = $Credential
GetScript = {
@{
GetScript = $GetScript
SetScript = $SetScript
TestScript = $TestScript
Result = $True
}
}

SetScript = {
# Do nothing
}

TestScript = {
$True
}
}
}
}

——— PartConfig.ps1 snip ————-

——— Run.ps1 snip ————-

$Node = 'MyTestNode'
$PullServer = 'MyTestPullServer'
$GUID = 'b32e5e76-fe9f-4fef-8d58-9ff9d3a268d3'
$MOFDestPath = 'C:\Program Files\WindowsPowerShell\DscService\Configuration'

# Import Functions
. "$PSScriptRoot\LCMConfig.ps1"
. "$PSScriptRoot\PartConfig.ps1"

# Generate MOF files
$MOFFile = PartConfig1 -OutputPath $MOFDestPath
New-DscChecksum -Path "$MOFDestPath\$MODFile" -Force

$MOFFile = PartConfig2 -OutputPath $MOFDestPath
New-DscChecksum -Path "$MOFDestPath\$MODFile" -Force

# Generate Meta MOF file
LCMConfig -ComputerName $Node -PullServer $PullServer -GUID $GUID -OutputPath "$PSScriptRoot\Temp"

# Send Meta MOF config to Node
Set-DscLocalConfigurationManager -ComputerName $Node -Path "$PSScriptRoot\Temp" -Verbose

# Update Configuation
Update-DscConfiguration -ComputerName $Node -Wait -Verbose

——— Run.ps1 snip ————-

September 8, 2015 at 5:04 am

Have you reported this to Microsoft?

September 8, 2015 at 5:11 am

Hi Don, thanks for the quick response. Not yet, but if someone else can confirm they are seeing the same thing in their environment, I'll post it on Connect.

This is bug number 3 for me. Hopefully MS can fix the issues before full production is released. This particular bug massive show stopper for me. I haven't come across anyone else having this issue so I'm hoping it's just something weird with my environment and the proof of concept example runs perfectly on someone elses environment.

Partial Conf Bug 1:
https://connect.microsoft.com/PowerShell/feedback/details/1624273/dsc-partial-configuration-bug-8-config-limit

Partial Conf Bug 2:
https://connect.microsoft.com/PowerShell/feedback/details/1515243/if-rebootnodeifneeded-false-and-a-reboot-is-required-partial-configurations-do-not-complete

September 8, 2015 at 5:13 am

What's in your two partial configuration MOF files? Do they both reference version 0.0?

We've seen some stuff going back and forth about this new "0.0" functionality in the MVP mailing list, and Microsoft has said that DSC is supposed to just import the latest available version of a module when it sees that. However, if a module is already loaded and then it errors out (even though it should just be importing the same, latest available version), then this is a bug that they need to fix.

September 8, 2015 at 5:22 am

Dave, you're onto something. The partial config mof files reference different module versions. That has to be bug. Please could you kindly keep us posted on any updates with this from the MVP mailing. It would be much appreciated!

—–PartConfig1 snip——
ModuleVersion = "1.0";
ConfigurationName = "PartConfig1";
};
—–PartConfig1 snip——

—–PartConfig2 snip——
ModuleVersion = "0.0";
ConfigurationName = "PartConfig2";
};
—–PartConfig2 snip——

September 8, 2015 at 5:23 am

Hmm, that's odd. You compiled the MOFs from the same computer, but for some reason they produced different versions in the output. I'll send a message to the mailing list referencing this thread, and see what comes up.

September 8, 2015 at 5:26 am

Yeah very strange.

I modified PartConfig2.mof and changed 0.0 to 1.0, which produced the following error.

Cannot find module PSDesiredStateConfiguration_1.0 from the server http://s12aumdc01tst01:8080/PSDSCPullServe
r.svc/Module(ConfigurationId='b32e5e76-fe9f-4fef-8d58-9ff9d3a268d3',ModuleName='PSDesiredStateConfiguration',
ModuleVersion='1.0')/ModuleContent.
+ CategoryInfo : ResourceUnavailable: (root/Microsoft/...gurationManager:String)

September 8, 2015 at 5:27 am

Try going the other way; change them both to 0.0.

September 8, 2015 at 5:44 am

Dave, you rock! The DSC configuration continued and the error didn't appear with the example code in the post.

I then did a "search and replace" on my production (preview) MOF files (83 hits) and changed all occurrences of ModuleVersion = "1.0"; to ModuleVersion = "0.0"; The DSC partial config is now applying to the node. Dirty as hell but hey it's a work around.

Lets hope Microsoft can fix this ASAP. I'll post the bug up on Connect tomorrow.

September 8, 2015 at 7:30 pm

September 8, 2015 at 8:37 pm

Fantastic! Thanks Don. MS are onto it.

October 29, 2015 at 6:18 am

A workaround to problem is import "PSDesiredStateConfiguration" module with version number on all of partial configs.

Example on my environment Get-DscResouce told that actually right version number is 1.1 and problem disappeared after I forced version number like this:
Import-DscResource -ModuleName @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="1.1"}