0

I am stuck at the below task:

I have 5 PowerShell scripts that need to be executed in parallel. I want to create a home.ps1 that will call to other test1.ps1, test2.ps1, test3.ps1,test4.ps1 and test5.ps1 at same time.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Niranjan
  • 1
  • 1
  • possible duplicate of [Can Powershell Run Commands in Parallel?](http://stackoverflow.com/questions/4016451/can-powershell-run-commands-in-parallel) – Scoregraphic Sep 08 '15 at 08:17

1 Answers1

0

You can use jobs for this:

$scripts = 'test1.ps1', 'test2.ps1', 'test3.ps1', 'test4.ps1', 'test5.ps1'

$scripts | ForEach-Object {
  Start-Job -FilePath $_
} | Wait-Job | Receive-Job

More information.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328