【问题标题】:Force PowerShell to use .NET CLR Version 2强制 PowerShell 使用 .NET CLR 版本 2
【发布时间】:2014-02-09 19:26:51
【问题描述】:

我在 Windows Server 2008 R2 Standard Server(德语)上运行 PowerShell 2。

我想使用 SharePoint 2010 管理控制台,但出现以下错误:

The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

Microsoft SharePoint is not supported with version 4.0.30319.1 of the Microsoft .Net Runtime.

调用 get-spfarm 时。

当我尝试识别版本时,我得到以下信息:

它使用 CLR 版本 4.0.30319.1:

SharePoint 似乎不支持此功能。

我尝试按如下方式运行 PowerShell:

PowerShell.exe -2.0 版

但不知何故 PoweShell 仍然使用 CLR 版本 4.0.30319.1:

互联网上很多人都表示他们在安装 Windows 更新 KB2506143 时遇到了这个问题。这没有安装在我的机器上。

如何强制 PowerShell 使用 .NET CRL 的 2.0 版本?

【问题讨论】:

  • 问题仍未解决。有没有人知道我还能检查什么来让它运行?

标签: .net sharepoint powershell clr


【解决方案1】:

似乎 Server 2008 上的文件是 Powershell.exe.activation_config。它位于 C:\Program Files(x86)\Common Files\NetApp。

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    查看您的 powershell.exe.config 文件。你看到/configuration/startup/requiredRuntime XML 元素了吗?

    http://msdn.microsoft.com/en-us/library/a5dzwzc9(v=vs.110).aspx

    【讨论】:

    • 我没有 powershell.exe.config 文件。我查看了以下两个文件夹: C:\Windows\SysWOW64\WindowsPowerShell\v1.0 C:\Windows\System32\WindowsPowerShell\v1.0
    • 也许你可以创建一个新的,然后添加requiredRuntime 元素。我认为正确的运行时版本是v2.0.50727。查看 c:\windows\Microsoft.NET\Framework64 文件夹下确定。
    • 我已将 powershell.exe.config 添加到以下两个文件夹:“C:\Windows\SysWOW64\WindowsPowerShell\v1.0”和“C:\Windows\System32\WindowsPowerShell\v1 .0”。该文件如下所示:<configuration> <startup> <requiredRuntime version="v2.0.50727" safemode="true" /> </startup> </configuration> 当我单击 powershell.exe 时,没有任何变化。我必须做些什么,以便读取配置文件吗?
    • 我相信当您启动应用程序时应该阅读它。尝试添加supportedRuntime 元素。 msdn.microsoft.com/en-us/library/w4atty68(v=vs.110).aspx
    • 我现在添加了supportedruntime。文件现在看起来像这样:<configuration> <startup> <supportedRuntime version="v2.0.50727" /> <requiredRuntime version="v2.0.50727" safemode="true" /> </startup> </configuration> 仍然没有变化。
    【解决方案3】:

    撤消您对系统所做的任何强制 PowerShell 或其他 .Net 应用程序使用 CLR 4 的更改。请参阅 here

    或安装 .Net 3.5(或 3.0 或 2.0),它将安装 CLR 2。如果您运行 Windows 8 或 2012,则需要通过更改 Windows 功能来实现。见here

    【讨论】:

      【解决方案4】:

      我们现在找到了解决问题的方法: 我们卸载了 .NET Framework 4(因为我们在 SharePoint Server 上不需要它)。 之后,我们可以再次使用 PowerShell for SharePoint。

      【讨论】:

        猜你喜欢
        • 2012-07-10
        • 1970-01-01
        • 1970-01-01
        • 2010-09-13
        • 2011-12-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-27
        相关资源
        最近更新 更多