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
Get Windows PowerShell for Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.