5

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 Answers 4

8

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

Sign up to request clarification or add additional context in comments.

2 Comments

You can also edit/create a shortcut to launch the sharepoint command module in V2: 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 ' "
Does not work for script $w = get-spwebapplication , still shows error: PlatformNotSupported (4.0 runtime)
0

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

Comments

0

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

1 Comment

This post is about PowerGUI. There is no configuration file powershell.exe.config in C:\Windows\System32\WindowsPowerShell\v1.0.
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.