我有一些使用环境资源设置path值的部分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以来,有什么改变?
您有两个具有相同名称参数值的环境资源(variables)。 当引擎创build环境variables时,这可能会导致冲突。 我build议你改变这样的东西:
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
只是一个快速更新,但目前有关于这个确切的问题与MSFT的要求…