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


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 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.


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



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