I have the following script,
$createZip = { Param ([String]$source, [String]$zipfile) Process { echo \"zip: $source`n --> $zipfile\"
This should be a comment really, but I don't have the reputation to leave comments.
My answer is that you should use Andy Arismendi's answer, but also output $job.ChildJobs[0].Error
$job.ChildJobs[0].Error
As $job.ChildJobs[0].JobStateInfo.Reason.Message isn't always useful.
$job.ChildJobs[0].JobStateInfo.Reason.Message