I am updating a PowerShell script that manages some .NET assemblies. The script was written for assemblies built against .NET 2 (the same version of the framework that Power
The best solution I have found is in the blog post Using Newer Version(s) of .NET with PowerShell. This allows powershell.exe to run with .NET 4 assemblies.
Simply modify (or create) $pshome\powershell.exe.config
so that it contains the following:
Additional, quick setup notes:
Locations and files are somewhat platform dependent; however will give you an inline gist of how to make the solution work for you.
cd $pshome
in the Powershell window (doesn't work from DOS prompt).
C:\Windows\System32\WindowsPowerShell\v1.0\
powershell.exe.config
if your PowerShell.exe
is being executed (create the config file if need be).
PowerShellISE.Exe
is running then you need to create its companion config file as PowerShellISE.Exe.config