struggling with parralele tasks
Hi,
I’m trying to improve my code by using parrallele tasks. I’m struggling with testing the connections.
$cpt = get-adcomputers -filter *
$s = New-PSSession -ComputerName $Srv_list.DNSHostName
$WSUSjob = Invoke-Command -session $s {
write-host $(hostname)
}
} -JobName WSUSjob -AsJob
$j = Get-Job
$results = $j | Receive-Job
I would know how to test a connection with a foreach and a try catch on a SINGLE computer, but what would be the right way of handling the result of the New-Pssession when using it directly on an ARRAY ?
In my example it works and open sessions on answering computers. But I don’t know how to retrieve the ones that didn’t answer.
Thank you.
Hi, I’m trying to improve my code by using parrallele tasks. I’m struggling with testing the connections. $cpt = get-adcomputers -filter *$s = New-PSSession -ComputerName $Srv_list.DNSHostName$WSUSjob = Invoke-Command -session $s {write-host $(hostname)}} -JobName WSUSjob -AsJob$j = Get-Job$results = $j | Receive-Job I would know how to test a connection with a foreach and a try catch on a SINGLE computer, but what would be the right way of handling the result of the New-Pssession when using it directly on an ARRAY ? In my example it works and open sessions on answering computers. But I don’t know how to retrieve the ones that didn’t answer. Thank you. Read More