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

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

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.

About these ads
  1. November 14, 2012 at 2:48 am

    It did not work for me.

  2. RWL01
    May 15, 2013 at 7:11 am

    I updated all the config files in that folder and it worked for me.

  3. June 20, 2013 at 2:34 pm

    Worked wonderfully well for me.

  4. WU
    February 5, 2014 at 9:02 pm

    Worked wonderfully well for me

  5. August 19, 2014 at 7:53 pm

    Trick helped me.. Thanks..!

  1. August 31, 2012 at 2:59 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 169 other followers

%d bloggers like this: