PowerWebpart running PowerShell 4.0

Apr 27, 2015 at 8:11 PM
Question: is there a way to have the PowerWebpart launch in a PowerShell 4.0 environment?

Setup:
I'm using PowerWebpart to manage Active Directory accounts.
With Server 2012 the AD tools have changed to run under .NET 4.0
PowerWebpart still runs under PowerShell 2.0.
AD Management fails as it can load assemblies for version 4.0 modules
SharePoint 2010

Previously I was running successfully on Windows 2008 when the AD Management was set to run under .NET 2.0.
Jun 12, 2015 at 11:09 PM
Edited Jun 12, 2015 at 11:11 PM
self answering

The problem is that SharePoint 2010 requires running under .NET 2.0. So when the powerwebpart function runs it relies on System.Management.Automation to call the PowerShell object. So SharePoint passes along that it needs the System.Management.Automation supported by .NET 2.0. Problem then leads to any modules you are using from that point forward must be compatible with 2.0 and 3.5.

There is not a direct way to run any of the latest PowerShell modules in Win Server 2012 that require .NET 4.0 under this webpart. So this breaks the Active Directory solution I have for creating and managing user accounts directly.

The .NET 2.0 versus 4.0 may clear itself up automatically if you deploy to SharePoint 2013.

Michael Ham
Seattle, WA