2012-10-15 15 views
8

我遇到了一些PowerShell問題。首先,SharePoint 2010安裝的PS配置不斷彈出此消息:如何讓SharePoint PowerShell使用.NET 2

本地場不可訪問。具有FeatureDependencyId的Cmdlet未註冊。

我已經使用了Google,並給予每個人和他們的第二表弟Sharepoint_Shell_Access到配置數據庫,沒有運氣。所以,我想嘗試一些PS命令。但是,在這種情況下,我收到了另一個錯誤:

Microsoft .NET不支持Microsoft .NET運行時版本4.0.30319.17929。

我得到的SP不能使用.NET 4.0或4.5,但我找不到任何關於如何讓PS使用.NET的「正確」版本的建議。我找到了一些名爲PowerGUI的參考,並更改了psgui.exe.config,但我沒有。

有沒有人對如何解決.NET版本問題有任何建議?

回答

13

當您安裝powershell v3時,版本2仍可在並排模式下使用。爲了使用SharePoint管理單元,您必須像這樣啓動v2:

powershell -v 2 

然後,您可以加載SharePoint管理單元。

供參考,在這裏是調用的PowerShell v2的輸出從Windows 8的cmd.exe:

C:\Windows\System32\WindowsPowerShell\v1.0>powershell.exe -version 2 
Windows PowerShell 
Copyright (C) 2009 Microsoft Corporation. All rights reserved. 

PS C:\Windows\System32\WindowsPowerShell\v1.0> $psversiontable 

Name       Value 
----       ----- 
CLRVersion      2.0.50727.6387 
BuildVersion     6.1.7600.16385 
PSVersion      2.0 
WSManStackVersion    2.0 
PSCompatibleVersions   {1.0, 2.0} 
SerializationVersion   1.1.0.1 
PSRemotingProtocolVersion  2.1 


PS C:\Windows\System32\WindowsPowerShell\v1.0> [Environment]::Version 

Major Minor Build Revision 
----- ----- ----- -------- 
2  0  50727 6387 
+0

是的,試過了,但它仍然看起來.NET 4.0。 – EoRaptor013

+0

@ EoRaptor013 - 那麼你做錯了。我每天都在使用這種技術。看看上面的例子(由@goyuix友好地添加) – x0n

+0

你是對的;我做錯了。把命令行開關放在錯誤的地方。糾正這個錯誤,註冊PS與.NET 2.0環境。謝謝您的幫助! – EoRaptor013

4

人們可以通過右鍵單擊它,選擇Properties命令行開關-version 2添加到Start Menu項目,編輯Target字段中的字符串。

此修復程序也清除了錯誤消息

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

推出的SharePoint 2010 Management Shell中,當我得到這個消息。

+0

如果你認爲這個問題是一個很好的帖子,請做一個加票。 –

相關問題