Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell Chef-guard解释器中的变量_Powershell_Chef Infra_Guard_Recipe - Fatal编程技术网

Powershell Chef-guard解释器中的变量

Powershell Chef-guard解释器中的变量,powershell,chef-infra,guard,recipe,Powershell,Chef Infra,Guard,Recipe,厨师guard\u解释器资源是否可以进行变量评估?它在此代码中不起作用。谢谢 guard_interpreter :powershell_script not_if '( (gwmi win32_computersystem).name -eq "#{servername}" )' 解决了问题。我需要双引号,而不是围绕powershell代码的单引号:not_if“((gwmi win32_computersystem).name-eq“{servername}”)”是的,这正是问题所在:

厨师
guard\u解释器
资源是否可以进行变量评估?它在此代码中不起作用。谢谢

guard_interpreter :powershell_script  
not_if '( (gwmi win32_computersystem).name -eq "#{servername}" )'

解决了问题。我需要双引号,而不是围绕powershell代码的单引号:not_if“((gwmi win32_computersystem).name-eq“{servername}”)”是的,这正是问题所在:)。你应该回答你自己的问题:)