Powershell 3.0 使用2.0运行时启动PowerShell ISE

Powershell 3.0 使用2.0运行时启动PowerShell ISE,powershell-3.0,Powershell 3.0,安装PowerShell 3.0后,我可以强制PowerShell开始使用版本2.0 -Version Starts the specified version of Windows PowerShell. Enter a version number with the parameter, such as "-version 2.0" 这对于不支持.Net Framework V 4(SharePoint!)的管理单元非常有用 是否有适用于PowerShell ISE的等效工

安装PowerShell 3.0后,我可以强制PowerShell开始使用版本2.0

-Version
    Starts the specified version of Windows PowerShell.
    Enter a version number with the parameter, such as "-version 2.0"
这对于不支持.Net Framework V 4(SharePoint!)的管理单元非常有用

是否有适用于PowerShell ISE的等效工具

我试图运行powershell_ise.exe-2.0版,但这不起作用


运行
powershell_ise.exe-help
不会显示任何可以满足我需要的参数。

调整配置文件没有帮助,powershell_ise.exe肯定依赖于.Net V4。它还严重依赖于PowerShell引擎的V3版本

在安装PowerShell V3后,不支持以任何方式运行PowerShell ISE的V2。与核心PowerShell二进制文件(如System.Management.Automation.dll)不同,我认为V2 ISE二进制文件在V3安装过程中会被覆盖或删除


恐怕您必须从powershell.exe运行脚本。

您可以通过创建新的PSSession来运行2.0运行时命令

Register-PSSessionConfiguration -Name PS2 -PSVersion 2.0 –ShowSecurityDescriptorUI

# Please consult system admin when your run set-item and Enable-WSManCredSSP command
Set-Item wsman:localhost\client\trustedhosts -value * -Confirm:$false -Force
Enable-WSManCredSSP -Role Client –DelegateComputer * -Force
Enable-WSManCredSSP -Role Server -Force

# For test purpose
# Get-WSManCredSSP
# get-item wsman:localhost\client\trustedhosts

$cred = Get-Credential
$session = New-PSSession -ComputerName $env:COMPUTERNAME -authentication credssp -ConfigurationName PS2 -Credential $cred
Enter-PSSession $session

# 2.0 runtime
Add-PSSnapin microsoft.sharepoint.powershell
$web = Get-SPWeb http://SPSite/
$web.Url

Exit-PSSession

Unregister-PSSessionConfiguration -Name PS2

Disable-WSManCredSSP -Role Client
Disable-WSManCredSSP -Role Server

如果不退出PSSession,可以从Powershell ISE 3运行2.0运行时命令。

我调整了此文件,但是,ISE似乎需要.Net V4,因为它会因此调整而崩溃。的可能重复项