SharePoint 2010 and PowerShell 3.0

Posted on 2/26/2013 @ 6:38 PM in #SharePoint by | Feedback | 4487 views

Ever seen this error when you run a PowerShell command in the SP PowerShell?

Microsoft SharePoint is not supported with version 4.0.30319.18034 of the Microsoft .Net Runtime.

SharePoint 2010 does not work with PowerShell 3.0. It can be made to work, but the workarounds are worse than the cure. So what do we do?

Two solutions,

a) Easy: On a Windows Server 2008 R2 machine, uninstall KB2506143 – Windows Management Framework 3.0. This will bring everything back to normal.

b) Better: If your sysadm’s won’t let you uninstall KB2506143, or unfortunately it is part of windows update, so it will keep reinstalling itself if your server is configured for auto patching, here is what you can do,

  1. Right-click SharePoint 2010 Management Shell, choose Properties.
  2. In the Shortcut tab in the SharePoint 2010 Management Shell Properties window write the following value in the Target field:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 2.0 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "

That’s basically it! Now you can enjoy the love of PowerShell 3.0 while keeping the SharePoint 2010 Management Shell in PS 2.0. That said, PowerShell 3.0 is really nice :), and I’m glad SharePoint 2013 makes use of it.

Sound off but keep it civil:

Older comments..