首页 > 解决方案 > 调用 Microsoft Exchange 命令

问题描述

Microsoft Exchange 最近的一个补丁改变了人们对 Microsoft Exchange 服务器使用 Invoke-Command 的方式。

Invoke-Command -Session $ExOSessionVariable -ScriptBlock {Get-RemoteMailbox -Identity UserName ; Get-User -Identity UserName}

正在返回:

The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode.

此后此行为发生了变化:https ://techcommunity.microsoft.com/t5/exchange-team-blog/released-april-2021-exchange-server-security-updates

Microsoft 建议使用 .AddScript() 或 .AddCommand()。有人可以告诉我如何将这个命令与 invoke-Command 一起使用吗?

任何帮助表示赞赏。

迈克尔

标签: windowspowershellexchange-serverinvoke-command

解决方案


推荐阅读