Is PowerShell v4.0 okay for use with this PowerShell Workflow Activity

Apr 9, 2014 at 5:17 PM
We want to install the PowerShell Workflow Activity here at our school district but I've read that it doesn't work with PowerShell versions beyond 3.0 and we are at PowerShell 4.0.

We're running our FIM 2010 r2 on a Windows Server 2008 r2 and have Windows Management Framework 3.0 installed which provides only PowerShell v4.0 (not 3.0). I checked the version via the registry (HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\POWERSHELL\3\PowerShellEngine\PowerShellVersion) and ran the PS cmd $PSVersion.PSVersion which all report 4.0).

Can we proceed even though we have PS 4.0 installed. If not, how can we get back to PS 3.0? I tried uninstalling Windows Management Framework and re-installed WMF 2.0 which gave me PS 2.0 but when I installed WMF 3.0 (again), we are again at PS 4.0.

Thanks in advance for any assistance that you can be.

Mike Lane
Apr 9, 2014 at 5:24 PM
Hi Mike, the constraint there is that the FIM Service uses a workflow host based on Workflow Foundation 3.5 (.NET 3.5). You can probably use PowerShell V4 but any commands that depend on .NET 4 will not work because the host is based on an older version of .NET. The common problem is using the ActiveDirectory module from a FIM PowerShell Workflow.

A workaround would be to use Invoke-Command to force a new session, but you'd be taking on the overhead for each workflow instance. On a busy server that could be pretty expensive.
Apr 9, 2014 at 5:44 PM
Thanks for the quick response Craig and I really appreciate this code and your blog.

Is the "host" that you referred to in your answer the dll for this WF Activity or something else? We do use the AD MA in FIM a lot and want to use PS (v 3.0) commands for WF Activities and I would think that as long as we restrict ourselves to using PS 3.0 commands/cmdlets, we would be okay. Do you know of any problems that we might expect?

Thanks again,

Mike Lane
Apr 25, 2014 at 5:20 PM
Edited Apr 25, 2014 at 5:20 PM
Hi,

I found a tick to use (in my case) Powershell in version 3.0

I simply add

<startup>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>

under the “configuration” node in the config file of FIMService

I write a post about it on my blog http://idmgnt.wordpress.com/

But i don't know if it's supported by MS

Regards,

Sylvain
Apr 28, 2014 at 3:12 PM
Thanks SlyvainC for the configuration info. I was not aware that applications compiled under .Net 4.0 will only have PS 2.0.

Mike Lane
Sep 2, 2014 at 7:54 AM
@SylvainC, its worth mentioning that I just recently used a lot of time troubleshooting pwd reset, I could NOT get it working, and the errors did not help me at all. The problem was the startup lines. When using v4.0 first, pwd reset broke down. Remove the lines, or put v2.0 first in line solved the problem.

And no. Its not supported :)