在C#中运行Exchange Powershell命令 [英] Running Exchange powershell commands in C#

查看:205
本文介绍了在C#中运行Exchange Powershell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试编写一个运行交换PS命令(Get-mailbox和Get-MailboxStatistics)的C#应用​​程序
当我在MS Visual Studio中进行测试时,效果很好...但是当我独立运行它时,出现错误:

由于以下错误,因此无法加载Windows PowerShell管理单元Microsoft.Exchange.Management.PowerShell.Admin:t
"Microsoft.Exchange.Data.Directory.Globals"的ype初始化程序引发了异常."


有什么想法吗?

非常感谢,
Phil

Hi Guys,

i''m trying to write a C# app that runs exchange PS commands (Get-mailbox and Get-MailboxStatistics)
When i''m testing within MS Visual Studio it works fine... but when i run it standalone i get an error:

"Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.Admin because of the following error: The t
ype initializer for ''Microsoft.Exchange.Data.Directory.Globals'' threw an exception."


any ideas?

Many Thanks,
Phil

推荐答案

尝试了 ^ ]?


已添加了Microsoft.Exchange.Data.Directory DLL和来自交换服务器的所有引用dll.
have u added the dll Microsoft.Exchange.Data.Directory and all reference dll from exchange server.


这篇关于在C#中运行Exchange Powershell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆