我有许多使用环境资源设置路径值的部分 DSC 脚本。我有两个执行此操作的脚本,从 WMF5.0 升级到 WMF5.1 后,启动 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
一个脚本执行此操作:
Environment SqlCmdPath {
Name = "Path"
DependsOn = "[Package]InstallSQLServer2012CmdLineUtils_64bit"
Ensure = "Present"
Path = $true
Value = "$env:ProgramFiles\Microsoft SQL Server\110\Tools\Binn"
}
另一个脚本执行此操作:
Environment SetInstantClientPath {
Name = "Path"
DependsOn = "[Archive]InstallInstantClientBasic","[Archive]InstallInstantClientSqlplus"
Ensure = "Present"
Path = $true
Value = "$env:SystemDrive\instantclient_11_2"
}
这曾经从 WMF5.0 愉快地运行
自 WMF5.1 以来有什么变化吗?
您有两个具有相同名称参数值的环境资源(变量)。当引擎开始创建环境变量时,这可能会导致冲突。我建议你改成这样:
https://msdn.microsoft.com/en-us/powershell/dsc/environmentresource
只是一个快速更新,但目前 MSFT 有一个关于这个确切问题的请求......
https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088876-dsc-environment-resource-does-not-allow-duplicate