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