[英]C# remote (exchange)powershell
i made a while back an console application(in c#) which does a few powershell commands.前一段时间我做了一个控制台应用程序(在 c# 中),它执行一些 powershell 命令。 i connect to the (exchange)powershell with remote powershell. but when the application runs;
我使用远程 powershell 连接到(交换)powershell。但是当应用程序运行时;
RunspaceFactory.CreateRunspace(connectioninfo)
i get the following exception:我得到以下异常:
Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
无法加载文件或程序集“Microsoft.Management.Infrastructure,Version=1.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。 The system cannot find the file specified.
该系统找不到指定的文件。
the only thing i cannot figure out is why it was working before perfectly.我唯一不明白的是为什么它之前工作得很好。 i searched my solution, nowhere i could find a reference to that dll. i also searched my c# drive it was nowhere to be found either.
我搜索了我的解决方案,但在任何地方都找不到对 dll 的引用。我还搜索了我的 c# 驱动器,它也无处可寻。 i restored my solution from my backup of 2-3 months old and the same error.
我从 2-3 个月前的备份和同样的错误中恢复了我的解决方案。 Can someone give me some pointers to what is going wrong?
有人可以给我一些指示,指出出了什么问题吗?
Found the problem.发现了问题。 apparently something is wrong on my computer(I'm guessing after installing the Beta of VS11)
显然我的电脑出了问题(我猜是在安装了 VS11 的 Beta 之后)
anyhow, after using the project on a different machine where VS2010 is installed it worked just fine.无论如何,在安装了 VS2010 的另一台机器上使用该项目后,它工作得很好。
The error message is misleading.错误消息具有误导性。
I had got the error, as I used the reference to the System.Management.Automation.dll Version 3.0.0.0 (which means PowerShell 3.0).我遇到了错误,因为我使用了对 System.Management.Automation.dll 版本 3.0.0.0(即 PowerShell 3.0)的引用。
The issue is, the Exchange Server 2007/2010 isn't compatible with PowerShell 3.0, so you must bind the reference to the System.Management.Automation.dll version 1.0.0.0 (Windows PowerShell 2.0).问题是,Exchange Server 2007/2010 与 PowerShell 3.0 不兼容,因此您必须将引用绑定到 System.Management.Automation.dll 版本 1.0.0.0 (Windows PowerShell 2.0)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.