5
votes

Today my powershell updated to version 3.0. This version is build against and uses .NET runtime 4.0. The Sharepoint 2010 cmdlets require .NET 3.5 and don't work under 4.0. Anyone has an idea how to get scripts work?

I receive this error: Remove-SPSite : Microsoft SharePoint is not supported with version 4.0.30319.296 of the Microsoft .Net Runtime.

4

4 Answers

8
votes

try to launch powershell with : powershell.exe -version 2.0

0
votes

I had some trouble with this today too but this worked out for me.

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 ' "

At first I think i had a trailing space which made it not work but you can always check it out with $psversiontable and make sure that CLRVersion is 2.0.50727.5466

0
votes

powershell.exe -v 2 also should work fine

Edit:

it's better to uninstall windows update which caused this issue KB2506143

check this article

Do not install the Windows Management Framework 3.0 (KB2506143) on SharePoint 2010 Servers

0
votes

Type "PowerShell -v 2" (without quotes). on the top of the script then you for second run comment it using #, if the script hangout This loads PowerShell version 2, and you should be able to use it for SharePoint. Just type 'Exit' to get back to PowerShell v3