Exchange Powershell - 如何从内部脚本调用 Exchange 2010 模块?
我正在编写一个脚本,该脚本可以使用 AD 和 Exchange 执行许多操作,并且刚刚到达 GUI 的部分,我需要在其中开始使用 Exchange,但看不到可以手动指定包含 Exchange 模块的位置。我熟悉的正常过程是导入模块活动目录,但导入模块交换不起作用。
我执行了 Get-Module -ListAvailable |选择名称,但看不到任何表示 Exchange 的内容。但是,Exchange 命令行管理程序已加载到我正在使用的 Exchange 服务器上。
有谁知道如何在我的脚本中包含 Exchange 2010 模块,以便我可以在内部使用特定于交换的 cmdlet?蒂亚...
I'm writing a script that does a number of things with AD and Exchange and just got to the part of the GUI where I need to start working with Exchange but don't see where I can manually specify to include the Exchange module. The normal process I'm familiar with is import-module activedirectory but import-module exchange doesn't work.
I performed a Get-Module -ListAvailable | Select Name, and don't see anything indicating Exchange. However, the Exchange Management Shell IS loaded on the Exchange server I'm working on.
Does anyone know how to include the Exchange 2010 module in my script so I can use the exchange-specific cmdlets internally? TIA...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可以这样做:
并且大部分都可以工作(尽管 MS 支持会告诉你不支持这样做,因为它绕过了 RBAC)。
我发现一些 cmdlet(特别是启用/禁用 UMmailbox)存在问题,无法仅在加载的管理单元中使用。
在 Exchange 2010 中,它们基本上不支持在实际 EMS shell 的隐式远程处理环境之外使用 Powershell。
You can do this:
and most of it will work (although MS support will tell you that doing this is not supported because it bypasses RBAC).
I've seen issues with some cmdlets (specifically enable/disable UMmailbox) not working with just the snapin loaded.
In Exchange 2010, they basically don't support using Powershell outside of the the implicit remoting environment of an actual EMS shell.
我知道这是一个老问题,但我没有添加显然不受支持的管理单元,而是查看了 EMS 快捷方式属性并复制了这些命令。
完整的快捷方式目标是:
因此,我将以下内容放在脚本的开头,它似乎按预期运行:
注意:
I know this is an old question, but rather than adding the snapin which is apparently unsupported, I just looked at the EMS shortcut properties and copied those commands.
The full shortcut target is:
So I put the following at the start of my script and it seemed to function as expected:
Notes:
import-module Microsoft.Exchange.Management.PowerShell.E2010a尝试使用一些实现,例如:
或
import-module Microsoft.Exchange.Management.PowerShell.E2010aTry with some implementation like:
or