Snapin non carica, i cmdlet ora mirano alla versione errata PowerShell, come è successo?
-
10-12-2019 - |
Domanda
Ho ereditato un ambiente Dev di Server-2008 SharePoint-2010, lo snapin di SharePoint non riesce a caricare;AVVERTENZA ...
Add-PSSnapin : Incorrect Windows PowerShell version 3.0. Windows PowerShell
version 2.0 is supported in the current console.
.
Ho seguito tutti i rimedi documentati:
- .
- Disinstalla WMF 3.0 e KB2506146
- Esegui PowerShell.exe con il parametro "-version 2.0"
- Rimuovi il riferimento a .NET 4.0 da PowerShell Config
Lo snapin non riesce a caricare e sempre lo stesso avviso "versione errata di Windows PowerShell ...", quindi confermo la versione.Sembra buono ...
.PS C:\Users\Administrator> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 2 0 -1 -1
Quindi ho controllato lo snapin ...
.PS C:\Users\Administrator> Get-PSSnapIn -Registered Name : Microsoft.SharePoint.PowerShell PSVersion : 3.0 Description : Register all administration Cmdlets for Microsoft SharePoint Server
La PSVersione è 3.0 ??? La psversion per lo snapin legge 1,0 su tutte le altre macchine.E non funziona in 3.0 a causa del framework 4.0 .NET.Come posso cambiare questo indietro?In modo che puntasse la versione compatibile di PowerShell? Grazie per qualsiasi aiuto puoi offrire.
Soluzione
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.