Author Posts

November 4, 2014 at 9:46 am

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

November 5, 2014 at 7:38 am

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.

November 5, 2014 at 2:56 pm

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

November 5, 2014 at 3:56 pm

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:)