Test-Connection -Quiet -Count 1 Hostname
gives output
Test-Connection: Testing connection to computer 'Hostname' failed: Cannot resolve the target name.
Expected behaviour would be
False
In a code block like
$comps | ForEach-Object -Process { if (Test-Connection $_.Name -Quiet -Count 1) {Write-Output "$($_.Name) on"} else {Write-Output "$($_.Name) off"} }
this gives output
Test-Connection: Testing connection to computer 'Hostname' failed: Cannot resolve the target name. Hostname off
Again, the extra output is unwanted, given the Quiet flag.
Test-Connection -Quiet -Count 1 Hostnamegives output
Test-Connection: Testing connection to computer 'Hostname' failed: Cannot resolve the target name.Expected behaviour would be
FalseIn a code block like
$comps | ForEach-Object -Process { if (Test-Connection $_.Name -Quiet -Count 1) {Write-Output "$($_.Name) on"} else {Write-Output "$($_.Name) off"} }this gives output
Test-Connection: Testing connection to computer 'Hostname' failed: Cannot resolve the target name. Hostname offAgain, the extra output is unwanted, given the Quiet flag.