如何在PowerShell v2中加载Powershell ISE 3?
我刚安装了新的PowerShell 3我的Windows 7机器上,比我发现PowerShell中的新版本不会与2010年的Sharepoint如何在PowerShell v2中加载Powershell ISE 3?
工作,我也发现了这个问题(here或here)的解决方案。但它只解决了标准PowerShell控制台的问题。当我们通过ISE完成大部分工作时,我想知道是否可以在ISE中做同样的事情?
我试着添加版本参数,但是ISE不知道它。我试图在ISE的控制台中输入powershell -version 2
,但它没有帮助。
如果不可能,我还有一个问题:我需要在Sharepoint 2010中使用ISE,那么如何卸载powershell 3和新的ISE?
当安装Windows Management Framework 3.0更新(它包含PS 3.0)时,这是一个已知问题,因为它使用.net 4.0使所有SP2010 cmdlet(它们都是3.5)不兼容。
控制台应用程序可以接受“-version 2”开关,但正如指出的那样,这与ISE不兼容。
这是一个known issue,另一article表明卸载WMF更新并重新启动服务器,我认为这是唯一真正的回答你的问题的最后一部分。
感谢您的链接。 – jumbo
非常有帮助,谢谢:) –
您可以通过创建新的PSSession来做到这一点。
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中运行2.0运行命令3.
你需要找出是否ISE足够定制什么,所以当它启动里面你PowerShell会话可以为powershell命令提供一个命令行参数。我将不得不安装新的ISE并自己看看。否则,你可能会停留在ISE中编辑脚本,但使用手动启动的控制台在外部测试。 – Roman
我看着设置,我找不到有用的东西。所以也许可以通过一些代码定制,也许在配置文件中。但我不知道任何关于这样的定制......现在看来我被卡住:( – jumbo
我没有尝试快速创建一个powershell_ise.exe.config文件按[强制应用程序...](http:///stackoverflow.com/questions/2046089/force-an-application-to-run-under-specific-net-runtime-version)。我认为该文件夹受到某种程度的保护,我将尽快进行研究。 – Roman