I am trying to load a .Net 4.0 assembly, using [Reflection.Assembly]::LoadFrom, inside of a remote Powershell 2.0 session. It works locally, due to a change I made to the powershell.exe.config file, but fails with a "This assembly is built by a runtime newer ..." exception in a remote session.
Both machines involved have .Net 2.0 and 4.0, and have the powershell.exe.config change for the x86 and x64 bit powershell executables. I've also tried changing the server powershell registry keys: HKLM:\Software\Microsoft\Powershell\1\PowerShellEngine\RuntimeVersion HKLM:\Software\Wow6432Node\Microsoft\Powershell\1\PowerShellEngine\RuntimeVersion
I must be missing something, but I don't know what it is.
Edit: Following is an example of the code I am executing.
PS C:\>Enter-PSSession -ComputerName server1
[server1]: PS C:\stuff> dir *.dll | foreach { [Reflection.Assembly]::LoadFrom( $_.FullName ) }