Every job has at least (an normally only one) child jobs. The output of the process is actually held in separate output buffers of the child jobs, and can be accessed from there. You can use Write-Verbose for one set of output, and Write-Warning for another, and read it back from the Verbose and Warning streams separately:
$computer=Get-Content "serverList.txt"
$jobArray=@()
$script={
$VerbosePreference = 'Continue'
$Args[0]
$cpuThresh=70
$cpuUsage=<Get CPU usage of the host>
Write-Verbose "CPU Usage: $cpuUsage %"
if ($cpuUsage -ge $cpuThresh) {
Write-Warning "Unexpected CPU Usage"
}
$Results = @{}
$Warnings = @{}
$Outputs = @{}
}
foreach ($system in $computer) {
$jobArray += Start-Job -ScriptBlock $script -ArgumentList $system
While ((Get-Job -State 'Running').Count -ge 10) {
Start-Sleep -Milliseconds 10
}
}
foreach ($job in $jobArray) {
While ($job.State -eq 'Running') {
Start-Sleep -Milliseconds 10
}
$Server = $Job.ChildJobs[0].Output[0]
$Results[$Server] = $Job.ChildJobs[0].Verbose
$Warnings[$Server] = $Job.ChildJobs[0].Warning
$Outputs[$Server] = $Job.ChildJobs[0].Output
Remove-Job -Job $job
}
Edit: updated for all local jobs.