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

Introduction

banner promo-01

Today, i will tell you about fixing “Microsoft SharePoint is not supported with version 4.0.30319.225 of the Microsoft .Net Runtime” in PowerGUI. This porblem started when I attempt to run some Powershell command against Sharepoint in PowerGUI , I experience some slip message as beneath:

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

The mistake message is really clear that Powergui attempt to run the Powershell command under .Net form 4.0 which is not backed by Sharepoint2010, Sharepoint2010 just help .Net 3.5.so in what capacity would I be able to change the settings so that Powershell does run under .Net3.5 in Powergui? The arrangement is really simple.

Solution

1. Open your windows explorer and explore to C:\program Files (x86)\powergui\ and open the configuration file Scripteditor.exe.config.

2. Change the supportedruntime form under Startup settings by deleting the version=”v4.0″ as underneath.

From :

<startup useLegacyV2RuntimeActivationPolicy=”true”>
<supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″ />
<supportedRuntime version=”v2.0.50727″ />
</startup>

To :

<startup useLegacyV2RuntimeActivationPolicy=”true”>
<supportedRuntime version=”v2.0.50727″ />
</startup>

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