2012-12-12 37 views
5

今天我的powershell更新到3.0版。这个版本是针对并使用.NET运行时4.0的。 Sharepoint 2010 cmdlet需要.NET 3.5,并且不能在4.0下运行。任何人都有一个想法如何让脚本工作?PowerShell 3.0 Sharepoint脚本不工作

我收到此错误: Remove-SPSite:Microsoft.Net运行时版本4.0.30319.296不支持Microsoft SharePoint。

回答

8

尝试推出PowerShell和:powershell.exe -version 2.0

+1

伟大的作品! – Ivan

+0

您也可以在V2中编辑/创建一个启动sharepoint命令模块的快捷方式:C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe -version 2.0 -NoExit“&'C:\ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 14 \ CONFIG \ POWERSHELL \ Registration \\ sharepoint.ps1'“ – kravits88

+0

不适用于脚本$ w = get-spwebapplication,仍显示错误:PlatformNotSupported(4.0运行时) –

0

我今天也遇到了一些麻烦,但是这个解决了我的问题。

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 2.0 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' " 

起初,我认为我有这使得它不工作,但你总是可以检查出来有$psversiontable,确保CLRVERSION是2.0.50727.5466

0

类型尾随空间“的PowerShell -v 2” (不含引号)。在脚本 的顶部,然后第二次运行使用#评论它,如果脚本环聊 这会加载PowerShell版本2,并且您应该可以将其用于SharePoint。只需键入'退出'返回到PowerShell v3

相关问题