By default PowerShell 2 is using .NET CLR 2.0.
It is quite annoying. I would like to be able to use something like [string]::IsNullOrWhitespace from .NET Framework 4
There are several approaches
1. Modify .NET settings globally saying to use only latest .NET CLR version
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"OnlyUseLatestCLR"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]
"OnlyUseLatestCLR"=dword:00000001
2. Modify or create the files powershell.exe.config and powershell_ise.exe.config in $PSHOME folder
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
To check what you have use
# Current PowerShell version
$host.Version
# Current .NET Framework version
[Environment]::Version
Unfortunately both of these approaches did not work well if you have PowerShell 3 installed.
If you run PowerShell.exe -Version 2 it will run PowerShell version 2 with .NET version 2 If you use one of the approached shown above
$host.Version is always 3 even if you ran PowerShell.exe -Version 2.
EDIT: Raised a bug https://connect.microsoft.com/PowerShell/feedback/details/767907/powershell-2-0-with-net-4-0-on-windows-8