Skip to Main Content
Windows PowerShell for Developers
book

Windows PowerShell for Developers

by Douglas Finke
July 2012
Intermediate to advanced content levelIntermediate to advanced
210 pages
4h 33m
English
O'Reilly Media, Inc.
Content preview from Windows PowerShell for Developers

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
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows PowerShell Cookbook

Windows PowerShell Cookbook

Lee Holmes
PowerShell in Practice

PowerShell in Practice

Richard Siddaway

Publisher Resources

ISBN: 9781449322694Errata Page