0

我为此问题搜索了很长时间,并发现了在远程 power shell 会话中使用变量的多个链接:

在远程 powershell 会话中使用局部变量

在 PowerShell 3.0 中将局部变量传递给远程会话

但是我找不到如何将其传递给引用的过滤器公式的部分的解决方案......

这是我认为应该起作用的:

Invoke-Command -Session $hex_session {New-AddressList -Name ($args[0] + " - All Rooms") -RecipientFilter ("(CustomAttribute1 -eq '" + $args[0] + "' -and (RecipientDisplayType -eq 'ConferenceRoomMailbox')") -RecipientContainer ("bla.blup.com/Hosted/"+$args[0])} -ArgumentList $Tenant

但是没有...

我在服务器上输入的原始命令是:

New-AddressList -Name "Tenant00001 – All Rooms" -RecipientFilter "(CustomAttribute1 -eq 'Tenant00001') -and (RecipientDisplayType -eq 'ConferenceRoomMailbox')" -RecipientContainer "bla.blup.com/Hosted/Tenant00001"

有人有同样的问题吗?

谢谢你的帮助

干杯伊夫

4

1 回答 1

1

好的......还有更多的试验和错误。我能够自己解决它。

这是解决方案:

Invoke-Command -Session $hex_session {New-AddressList -Name ($args[0] + " - All Rooms") -RecipientFilter ("(CustomAttribute1 -eq '$args') -and (RecipientDisplayType -eq 'ConferenceRoomMailbox')") -RecipientContainer ("bli.blup.com/Hosted/"+$args[0])} -ArgumentList $Tenant
于 2021-01-19T09:37:38.257 回答