您的位置:首页 > 运维架构 > Shell

让PowerShell2.0运行在.Net 4.0最简单的方法

2015-09-01 08:56 537 查看
给出链接详细的请自己看。The easy way to run Powershell 2.0 using .NET Framework 4.0http://viziblr.com/news/2012/5/16/the-easy-way-to-run-powershell-20-using-net-framework-40.html

简单的说照着下面操作就OK

1. $PSVersionTable

查看版本 CLRVersion 以 "2" 开头.

2. 以Administrator运行Powershell

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

$config_text| Out-File $pshome\powershell.exe.config
$config_text| Out-File $pshome\powershell_ise.exe.config


3. $PSVersionTable

查看版本 CLRVersion 以 "4" 开头.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息