Using Active Directory Commandlets in FIM PowerShell Workflow RRS feed

  • Question

  • I'm using Craig Martin's PowerShell Workflow activity and I want to enable some active directory accounts with a script running as an activity in a workflow. My problem is that when I do an Import-Module ActiveDirectory I get an error in event viewer like  "module cannot be imported because its manifest contains one or more members that are not valid" and if I don't include it the script fails on the Enable-ADAccount commands saying it's "not recognised as the name of a cmdlet, function... etc"

    So what am I doing wrong here? Is it possible to do what I'm trying to do with Craig's workflow activity?

    Monday, September 21, 2015 5:17 AM

All replies

  • I haven't tried it, but is this a PSVersion problem? I cant remember what version the PSHost in the workflow spins up and what version is required for the AD CMDlets.

    Regards, Soren Granfeldt
    blog is at | facebook | twitter at!/MrGranfeldt

    Tuesday, September 22, 2015 5:38 PM
  • Yes, it seems to be a versioning problem. It looks like the PowerShell WF activity fires up a PowerShell session that is version 2.0. I've tried a few things to get around it but have so far been unsuccessful. Any suggestions?
    Monday, October 26, 2015 5:55 AM
  • That's because the ActiveDirectory module manifest members reference\use .NET 4.0.

    You can correct this by forcing PowerShell application to run the 4.0.30319.34209 CLR or in the FIMService since that is the AppDomain that hosts Workflow

    For FIMService I think you just need to add the following:

        <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0.30319"/>
            <supportedRuntime version="v2.0.50727"/>

    Monday, October 26, 2015 9:29 PM