Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Work an Array in Batches of 5

$
0
0

You should get non-terminating errors for any computer that couldn’t be contacted. I tend to use -ErrorVariable to capture those:

Invoke-Command -ComputerName $listOfComputers -ScriptBlock { Do-Something } -ErrorAction SilentlyContinue -ErrorVariable myErrors

foreach ($errorRecord in $myErrors)
{
    # Handle $errorRecord
}

Viewing all articles
Browse latest Browse all 13067

Trending Articles