Snapinはロードされない、コマンドレットは現在間違ったPowerShellバージョンをターゲットにしています。
-
10-12-2019 - |
質問
Server-2008 SharePoint-2010 Dev環境を継承しました.SharePoint Snapinはロードできません。警告...
Add-PSSnapin : Incorrect Windows PowerShell version 3.0. Windows PowerShell
version 2.0 is supported in the current console.
.
私はすべての文書化された救済策を続けた:
- WMF 3.0とKB2506146 をアンインストールする
- "-version 2.0"パラメータでpowerShell.exeを実行します。
- PowerShell config から.NET 4.0への参照を削除します。
スナップインはロードされず、まだ同じ警告 "誤ったWindows PowerShellバージョン..."ではバージョンを確認します。それはよさそうだ...
.PS C:\Users\Administrator> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 2 0 -1 -1
だから私はスナピンをチェックしました...
.PS C:\Users\Administrator> Get-PSSnapIn -Registered Name : Microsoft.SharePoint.PowerShell PSVersion : 3.0 Description : Register all administration Cmdlets for Microsoft SharePoint Server
psversionは3.0 ??? SnapinのPSVersionは他のすべてのマシンで1.0を読み取ります。4.0 .NETフレームワークのため、3.0で実行されません。どうやってこれを変更するにはどうすればいいですか?それはそれがPowerShellの互換バージョンをターゲットにするように? あなたが提供することができるすべての助けをありがとう。
解決
The registry determines the level of PS compatibility, in my case the value was 3.0, it should be 1.0. I corrected this value by editing the following key:
HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.SharePoint.PowerShell\PowerShellVersion
The initial cause of the problem was the installation of the Windows Management Framework 3.0 which installs with it PowerShell. Even after uninstalling, the registry remained incorrect and I had to edit the registry with the information above.