Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.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 transportrule-在变量中设置多个组_Powershell_Powershell Ise - Fatal编程技术网

powershell transportrule-在变量中设置多个组

powershell transportrule-在变量中设置多个组,powershell,powershell-ise,Powershell,Powershell Ise,我正在尝试使用powershell在office 365中生成传输规则。在powershell脚本中执行第一个命令时,其行为与预期不符。但是,第二个命令在powershell中手动执行时会成功。似乎,当存储到变量时,只设置提供的第一个地址,而完全忽略第二个地址。我是不是误用了这个变量,或者是“duh”类的其他东西 从脚本: $groupfilter="distribution2@foo.bar,distro@foo.bar" set-transportrule -Identity "Filter

我正在尝试使用powershell在office 365中生成传输规则。在powershell脚本中执行第一个命令时,其行为与预期不符。但是,第二个命令在powershell中手动执行时会成功。似乎,当存储到变量时,只设置提供的第一个地址,而完全忽略第二个地址。我是不是误用了这个变量,或者是“duh”类的其他东西

从脚本:

$groupfilter="distribution2@foo.bar,distro@foo.bar"
set-transportrule -Identity "Filtering - Received Mail" -SentToMemberOf $groupfilter
通过powershell手动执行:

set-transportrule -Identity "Filtering - Received Mail" -SentToMemberOf distribution2@foo.bar,distro@foo.bar

据我所知,
-SentToMemberOf
接受一个数组。从
帮助设置传输规则

[-SentToMemberOf <RecipientIdParameter[]>]
指向数组,而不是逗号分隔的字符串

$groupfilter="distribution2@foo.bar,distro@foo.bar"
$groupfilter="distribution2@foo.bar","distro@foo.bar"