Workflows and Exchange

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of turbo mcp turbo mcp 2 years, 1 month ago.

  • Author
    Posts
  • #20311
    Profile photo of turbo mcp
    turbo mcp
    Participant

    Hi
    I love the concept of workflows
    and especially the power of processing
    but when I try to run some exchange powershell commands inside the workflow(I tried loading the ex ps-addin or remote connection)I get errors like this:

    Cannot call the 'New-PSSession' command. Other commands from this module have been packaged as workflow activities, but this command was

    specifically excluded. This is likely because the command requires an interactive Windows PowerShell session, or has behavior not suited

    for workflows. To run this command anyway, place it within an inline-script (InlineScript { New-PSSession }) where it will be invoked in

    isolation.

    + CategoryInfo : ParserError: (:) [], ParseException

    + FullyQualifiedErrorId : CommandActivityExcluded

    Microsoft.PowerShell.Utility\Write-Error : The term 'Get-Queue' is not recognized as the name of a cmdlet, function, script file, or

    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

    At queues:15 char:15

    +

    + CategoryInfo : NotSpecified: (:) [Write-Error], RemoteException

    + FullyQualifiedErrorId : System.Management.Automation.RemoteException,Microsoft.PowerShell.Commands.WriteErrorCommand

    + PSComputerName : [localhost]

    Microsoft.PowerShell.Utility\Write-Error : The term 'Get-Queue' is not recognized as the name of a cmdlet, function, script file, or

    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

    so I know there are a lot of limitations on workflows but is there away to overcome this and use EMS?
    it really could be much faster for me instead of foreach loops
    Thanks in advance

  • #20350
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Workflows don't run commands; they run "activities." Keep in mind that a workflow isn't run by PowerShell; it's run by Windows Workflow Foundation. WFF uses activities.

    The Exchange commands don't exist as activities, so they get run as implicit PowerShell scripts. Unfortunately, they also require PowerShell Remoting, and the New-PSSession command – which spins up a Remoting connection – isn't allowed.

    Short answer, Exchange commands and workflows aren't best friends.

  • #20373
    Profile photo of turbo mcp
    turbo mcp
    Participant

    Thanks
    no matter how I tried to spin it(inlinescript..) didn't work
    too bad it really helps me with other stuff run time deducated like crazy:)
    oh well have to find alternatives like jobs or runspaces or something

  • #20379
    Profile photo of turbo mcp
    turbo mcp
    Participant

    another thing that bugs me with workflows is it cant accept custom objects(or at least I think so) when using parallel
    I want to keep the data in some custom output and its a real pain...
    I can export to file but then because one is not aware of the other I get "in use" errors:)
    its like inventing tesla but forgetting to put the battery pack in it:)

You must be logged in to reply to this topic.