Share via

How to use ForEach-Object -Parallel in Azure Devops Pipeline Agent.

Ramakrishna Abhijeet P 70 Reputation points
2024-04-30T15:59:10.87+00:00

I want to use a PowerShell script which has below cmdlet. When I tried to use MS Hosted Pipeline agent with Parallel feature I'm getting "Parameter set cannot be resolved using the specified named parameters" error. How can I execute the script.

ForEach-Object -Parallel $scriptBlock
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

1 answer

Sort by: Most helpful
  1. Rich Matheisen 48,041 Reputation points
    2024-04-30T19:09:54.0966667+00:00

    The "-Parallel" parameter is present in PowerShell 7. It's not present in PowerShell 5. Which version of PowerShell are you using?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.