Recently i got this warning when starting SharePoint 2010 Management shell.
The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.
And if a tried to run a SharePoint command i got this error.
Get-SPAlternateURL : Microsoft SharePoint is not supported with version
4.0.30319.296 of the Microsoft .Net Runtime.
At line:1 char:1
+ Get-SPAlternateURL
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...GetAlternateUrl:
SPCmdletGetAlternateUrl) [Get-SPAlternateURL], PlatformNotSupportedExcepti
on
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetAlter
nateUrl
Screenshot
Solution
Create a new shortcut where you specify the powershell version you want to use or simply modify the existing shortcut.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 2 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "
I modified the existing shortcut to include –version 2 which makes it work.
Etiketter: Powershell, SharePoint 2010