I want to process each server in the pipeline in an infinite loop. However it is not working. I have the following code which is only returning the result of one (the first one) value from the pipeline.
ForEach ($HubServer in $Server)
$CurrentDateTime = Get-Date
Write-Host "Queue From " $Server " @ " $CurrentDateTime
Get-Queue -server $Server | select-object Identity, DeliveryType, Status, MessageCount, NextHopDomain, LastError, LastRetryTime | Ft -AutoSize
Write-Host “Press Ctrl+Break to quit”
Start-Sleep -s 5 } }
I would appreciate any ideas on how it can be done.