1

I have to call a long running workflow from another workflow asynchronously. Is there a way to do that in powershell?

workflow CalledWorkflow
{
    Start-Sleep -s 100;
}
workflow CallingWorkflow
{
   CalledWorkflow
   "CalledWorkFlow Invoked"
}

Now when i call

CallingWorkflow

I need the callingworkflow to immediately return printing "CalledWorkflow Invoked" so that i can start continue my work while the calledworkflow is running in backgroud.

saravanan
  • 398
  • 4
  • 13
  • PowerShell workflows have so many [restrictions](http://blogs.technet.com/b/heyscriptingguy/archive/2013/01/02/powershell-workflows-restrictions.aspx), it's hard to work out, if what you're trying to do is supported in some way. You can create a **Parallel** sequence in a workflow, but running workflows asynchronously... Why? – Jan Chrbolka Jun 29 '15 at 00:17
  • I just want to run a workflow in background I think it is possible if the calling module is a function. Any how thanks – saravanan Jun 29 '15 at 04:16

1 Answers1

0

What environment are you running the workflows in? In Azure Automation, you can accomplish this by starting a new job from within CallingWorkflow:

workflow CallingWorkFlow
{
  Start-AzureAutomationRunbook -Name CalledWorkflow -Parameters ...
  "CalledWorkFlow Invoked"
}

(Or Start-AzureRMAutomationRunbook for the RM version of the command).

I imagine you can do something similar in SMA, etc.

Cary
  • 363
  • 4
  • 10