How to fix “Microsoft SharePoint is not supported with version 4.0.30319.225 of the Microsoft .Net Runtime” in PowerGUI

Posted by ybbest on YBBest See other posts from YBBest or by ybbest
Published on Sat, 14 Jul 2012 00:50:13 +0000 Indexed on 2012/08/30 9:51 UTC
Read the original article Hit count: 831

Filed under: Error when finding categories...

Today, when I try to run some PowerShell command against SharePoint in PowerGUI , I encounter some error message as below:

Problem:

Remove-SPSite : Microsoft SharePoint is not supported with version 4.0.30319.225 of the Microsoft .Net Runtime.

At C:\SiteCreation.ps1:37 char:14

+ CategoryInfo : InvalidData: (Microsoft.Share…mdletRemoveSite:SPCmdletRemoveSite) [Remove-SPSite], PlatformNotSupportedException

Analysis:

The error message is pretty clear that PowerGUI try to run the PowerShell command under .Net version 4.0 which is not supported by SharePoint2010, SharePoint2010 only support .Net 3.5.So how can I change the settings so that PowerShell does run under .Net3.5 in PowerGui? The solution is pretty easy.

Solution:

1. Open your windows explorer and navigate to C:\Program Files (x86)\PowerGUI\ and open the configuration file ScriptEditor.exe.config.

2. Change the supportedRuntime version under Startup settings by removing the version=”v4.0″ as below

From


To


 

3. Restart your PowerGUI and rerun your script. It works like a charm.


© YBBest or respective owner