【问题标题】:PowerShell 3.0 Sharepoint scripts not workingPowerShell 3.0 Sharepoint 脚本不工作
【发布时间】:2012-11-30 03:00:15
【问题描述】:

今天我的 powershell 更新到了 3.0 版。此版本针对并使用 .NET 运行时 4.0。 Sharepoint 2010 cmdlet 需要 .NET 3.5,并且不能在 4.0 下运行。任何人都知道如何让脚本工作?

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

【问题讨论】:

    标签: sharepoint powershell


    【解决方案1】:

    键入“PowerShell -v 2”(不带引号)。在脚本的顶部 然后你在第二次运行时使用 # 评论它,如果脚本环聊 这将加载 PowerShell 版本 2,您应该能够将其用于 SharePoint。只需键入“退出”即可返回 PowerShell v3

    【讨论】:

      【解决方案2】:

      powershell.exe -v 2 也应该可以正常工作

      编辑:

      最好卸载导致这个问题的windows更新KB2506143

      查看这篇文章

      Do not install the Windows Management Framework 3.0 (KB2506143) on SharePoint 2010 Servers

      【讨论】:

      • 这篇文章是关于 PowerGUI 的。 C:\Windows\System32\WindowsPowerShell\v1.0中没有配置文件powershell.exe.config。
      【解决方案3】:

      我今天也遇到了一些麻烦,但这对我来说很有效。

      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

      【讨论】:

        【解决方案4】:

        尝试使用以下命令启动 powershell:powershell.exe -version 2.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 ' "
        • 不适用于脚本 $w = get-spwebapplication ,仍然显示错误:PlatformNotSupported (4.0 runtime)
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-11
        • 2012-06-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多