4

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?

Eric
  • 43
  • 2
  • From reading the error I can tell you it's expecting SqlCmdPath.Value and SetInstantClientPath.Value to be the same. Without seeing more code it'd be hard to tell you more. – Colyn1337 Mar 06 '17 at 16:43
  • That's what is says but I do not want that, I want to add the following two to the PATH, these are done on separate scripts: "$env:ProgramFiles\Microsoft SQL Server\110\Tools\Binn" "$env:SystemDrive\instantclient_11_2" – Eric Mar 07 '17 at 13:49

1 Answers1

2

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:

Environment SqlCmdPath {
    Name = "SqlCmdPath"
    DependsOn = "[Package]InstallSQLServer2012CmdLineUtils_64bit"
    Ensure = "Present"
    Path = $true
    Value = "$env:ProgramFiles\Microsoft SQL Server\110\Tools\Binn"
}
Environment SetInstantClientPath {
    Name = "SetInstantClientPath"
    DependsOn = "[Archive]InstallInstantClientBasic","[Archive]InstallInstantClientSqlplus"
    Ensure = "Present"
    Path = $true
    Value = "$env:SystemDrive\instantclient_11_2"
}

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

Colyn1337
  • 2,387
  • 2
  • 22
  • 38