2

I just installed the .NET Framework 4.0 and WMF 3.0 on a Server 2008 R2 SP1 machine that has SharePoint Foundation 2010 installed on it.

Now, when I go to Start - All Programs - Microsoft SharePoint 2010 Products - SharePoint 2010 Management Shell (run as administrator) I get the following error: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

If I type: add-PSSnapin Microsoft.SharePoint.PowerShell then Get-SPFarm, I get the following:

Get-SPFarm : Microsoft SharePoint is not supported with version 4.0.30319.1 of
the Microsoft .Net Runtime.
At line:1 char:1
+ Get-SPFarm
+ ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...SpCmdletGetFarm:
   SpCmdletGetFarm) [Get-SPFarm], PlatformNotSupportedException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SpCmdletGetFarm

It seems that after installing WMF 3.0, now Powershell is configured to run against .NET Framework 4.0. I am fine with that, but I need to be able to open at least one Powershell session against .NET 3.5 so that I can work with the SharePoint API.

Thanks,

GemCer
  • 175
  • 1
  • 6

1 Answers1

3

Why did you install it? Sharepoint 2010 is a .NET 3.5 app and not supported for use with .NET 4.0 like Sharepoint 2013 is, same for Powershell 3.0.

Regardless, you can fix this by running the shell in PS 2.0 mode. This helps if you are messing around with Sharepoint 2010 on a Windows 2012 server for instance.

in Powershell:

Powershell -version 2

Add-PSSnapin Microsoft.SharePoint.PowerShell

That should get you what you are after.

TheCleaner
  • 32,627
  • 26
  • 132
  • 191
  • I installed it so I can manage this server from the new Server Manager available in Server 2012/Windows 8. Thanks, your answer worked. – GemCer Nov 28 '12 at 15:05