Skip to content

Test-Connection shows unwanted output when DNS not resolved on Powershell 7.0.0 #12147

@chvol

Description

@chvol

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions