O'Reilly logo

Windows PowerShell for Developers by Douglas Finke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Running PowerShell with the .NET 4.0 Runtime

Here are the steps for configuring PowerShell v2 to run with the .NET 4.0 runtime. (This StackOverflow link has more information: http://bit.ly/GB6gEe.)

PS C:\> cd $PSHOME
PS C:\Windows\System32\WindowsPowerShell\v1.0>
    notepad .\powershell.exe.config

Add this XML and save the file:

<?xml version="1.0"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0.30319"/>
        <supportedRuntime version="v2.0.50727"/>
    </startup>
</configuration>

Restart the PowerShell console, and then type $PSVersionTable. You should see the following entry:

Name                           Value
----                           -----
CLRVersion                     4.0.30319.239

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required