Microsoft.Exchange.Management.PowerShell.Admin [英] Microsoft.Exchange.Management.PowerShell.Admin

查看:408
本文介绍了Microsoft.Exchange.Management.PowerShell.Admin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是服务器上的Microsoft.Exchange.Management.PowerShell.Admin有麻烦。该服务器是不运行Exchange 2007中的一个,它是一个远程服务器(在同一区域)。我无法弄清楚如何添加管理单元PowerShell的 - Microsoft.Exchange.Management.PowerShell.Admin。是否有可能只得到从Exchange 2007服务器DLL文件,并将其复制到我的代码正在运行的服务器?

I'm having troubles using the Microsoft.Exchange.Management.PowerShell.Admin on a server. The server is not the one running Exchange 2007, it's a remote server (in the same zone). I can't figure out how to add the Snapin for Powershell - Microsoft.Exchange.Management.PowerShell.Admin. Is it possible to just get the dll file from the Exchange 2007 server, and copy it to the server where my code is running?

有人能解释什么,我需要?做才能让我的代码运行

Can someone please explain what I need to do to get my code running?

这是我现在正在越来越唯一的例外是:没有的Windows PowerShell管理单元可用于版本1。这是生成错误的代码:

The exception that i'm getting now is: "No Windows PowerShell Snap-ins are available for version 1". This is the code that generates the error:

public void CreateMailBox(User user)
        {            
            //Create a runspace for your cmdlets to run and include the Exchange Management SnapIn...

            RunspaceConfiguration runspaceConf = RunspaceConfiguration.Create();
            PSSnapInException PSException = null;
            PSSnapInInfo info = runspaceConf.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out PSException);
            Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConf);

            runspace.Open();

            Pipeline pipeline = runspace.CreatePipeline();
            Command command = new Command("New-Mailbox");

            command.Parameters.Add("Name", user.UserName);



...

....

错误与PSSnapInfo信息行= runspaceConf .....
我使用.NET 3.5

The error is coming on the line with PSSnapInfo info = runspaceConf..... I'm using .NET 3.5

推荐答案

这也取决于代码是如何在VS 2010中(x86或x64)编译。如果要加载64位的Exchange Server管理单元,你必须使用x64编译。

It also depends on how the code is compiled in VS 2010 (x86 or x64). If you want to load the 64 Bit Exchange Server Snapin you have to compile with x64.

您可以用$ PsVersionTable检查,如果PowerShell是版本2.0(应该)

You can use $PsVersionTable to check if the PowerShell is version 2.0 (it should)

这篇关于Microsoft.Exchange.Management.PowerShell.Admin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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