I have a number of Partial DSC scripts that use the Environment Resource to set a Path value. I have two scripts that does this and after upgrading from WMF5.0 to WMF5.1, I am getting the following error when Starting the DscConfigurations.
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 MYCOMPUTER with user sid S-1-5-21-1064954374-356710528-937385128-34335.
VERBOSE: [DESTCOMPUTER]: [] Starting consistency engine.
The resources ('[Environment]SetInstantClientPath' and '[Environment]SqlCmdPath') have conflicting values of the following properties: 'Value'. 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 : DESTCOMPUTER
One script does this:
Environment SqlCmdPath {
Name = "Path"
DependsOn = "[Package]InstallSQLServer2012CmdLineUtils_64bit"
Ensure = "Present"
Path = $true
Value = "$env:ProgramFiles\Microsoft SQL Server\110\Tools\Binn"
}
And the other script does this:
Environment SetInstantClientPath {
Name = "Path"
DependsOn = "[Archive]InstallInstantClientBasic","[Archive]InstallInstantClientSqlplus"
Ensure = "Present"
Path = $true
Value = "$env:SystemDrive\instantclient_11_2"
}
This used to run happily from WMF5.0
Has something changed since WMF5.1?
You have two Environment Resource's (variables) which have the same Name parameter value. This is likely causing a conflict when the engine goes to create the environment variable. I recommend you change to something like this:
https://msdn.microsoft.com/en-us/powershell/dsc/environmentresource
Just a quick update but there's currently a request with MSFT regarding this exact issue...
https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088876-dsc-environment-resource-does-not-allow-duplicate