【发布时间】:2022-04-05 08:12:42
【问题描述】:
最近的 Microsoft Exchange 补丁改变了人们使用 Invoke-Command 到 Microsoft Exchange 服务器的方式。
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.
Microsoft 建议使用 .AddScript() 或 .AddCommand()。有人可以告诉我如何将这个命令与 invoke-Command 一起使用吗?
感谢任何帮助。
迈克尔
【问题讨论】:
-
你应该展示你是如何构建你的会话的。变量名称建议 exo 前缀,但该模块只是包装了图形 api。
标签: windows powershell exchange-server invoke-command