0

I have issues publishing a PowerShell workflow. Most of the script I am using is run in sequence, including the first for loop. But I would like to final for loop to execute in parallel. The code is as follows:

workflow myWorkflow {
code..
code..
regular for loop
   foreach -parallel
}
myWorkflow

An error occured while publishing the runbook 'myWorkflow'. Error details: The Runbook definition is invalid. The '-parallel' parameter can be used only within a workflow. The Runbook definition must contain only one definition which is workflow.. Error code: BadRequest..

The code runs very slow otherwise. Is there an issue with my code or the setup of the script?

3
  • 1
    Are you sure you're using the right syntax for your parallel block? Also, workflows are expected to be slow, even in parallel. They're meant for long running scripts. Commented Dec 24, 2021 at 0:15
  • a long running script for me is something that could take 4+ hours. I'll play around with the parallel block, I don't have much experience with workflows to begin with. thank you! Commented Dec 24, 2021 at 13:59
  • Right my point was, is it really needed a workflow? Commented Dec 24, 2021 at 15:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.