Reputation: 109
I have several PHP scripts, which execute a Powershell Script to obtain performance counters of my server infrastructure. As I have multiple scripts, I wanted to execute them all at the same time, from just one location.
I have created the following Start-Job script, which when run in the ISE, works perfectly fine.
When I run the ps1 script itself, using the below command, I get a list of the jobs that have started, but nothing actually happens. It just doesn't do anything, but also gives me zero errors.
So, what am I missing?
Upvotes: 1
Views: 1457
Reputation: 23355
Per the comments, when the calling powershell session terminates it is terminating all of the background jobs it started.
To make it wait for the jobs to complete before terminating add Get-Job | Wait-Job
at the end of your script.
Upvotes: 4