Reputation: 487
I have successfully connected to a remote powershell session through WinRM. It works like a charm. Problem begins when I try to import a module which uses an assembly built for .NET framework 4.
When working locally had the same problem but was easily solved by adjusting the app.config of powershell.exe. Tried doing the same on remote host but it doesn't work. I guess WinRM has it's own runspace that isn't related to powershell.exe.
Is there a way to configure WinRM so that it runs under .NET 4?
Upvotes: 3
Views: 844
Reputation: 60910
Try creating a c:\windows\System32\wsmprovhost.exe.config file and a c:\windows\SysWOW64\wsmprovhost.exe.config file in 64bit OS like this:
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Upvotes: 3
Reputation: 943
In a remote session what do you see with $PSversionTable? I think in PowerSHell 2.0 the remote runspace is configured automatically to use .NET Framework 2.0. When you enable remoting in PowerShell, it setups a listener and hooks it up to PowerShell.exe. I haven't found a way to to configure to use .NET 4.0. However, it looks like PowerSHell 3.0 uses .NET 4 by default.
Upvotes: 0