我想在远程Powershell 2.0会话中使用[Reflection.Assembly] :: LoadFrom加载.Net 4.0程序集。由于我对powershell.exe.config文件进行了更改,它在本地工作,但在远程会话中出现“此程序集由运行时更新......”异常失败。Powershell 2.0 Remoting加载.Net 4.0 dll
涉及的两台计算机都具有.Net 2.0和4.0,并且对x86和x64位powershell可执行文件具有powershell.exe.config更改。我也试图改变服务器的PowerShell注册表项:HKLM :\软件\微软\ Powershell的\ 1 \ PowerShellEngine \ RuntimeVersion HKLM:\ SOFTWARE \ Wow6432Node \微软\ Powershell的\ 1 \ PowerShellEngine \ RuntimeVersion
我必须错过了一些东西,但我不知道它是什么。
编辑: 以下是我正在执行的代码的一个示例。
PS C:\>Enter-PSSession -ComputerName server1
[server1]: PS C:\stuff> dir *.dll | foreach { [Reflection.Assembly]::LoadFrom($_.FullName) }
请显示您正在使用的命令.. – 2011-01-08 01:59:15