Test-Connection - Resolving address names
Votes from Connect: 10
Original Date Submitted: 8/28/2012 1:41:15 AM
Handle: Shay Levi
Site Name: PowerShell
Feedback ID: 759607
Frequency: Always Happens
Regression: Yes, this happens in all previous versions
When the Test-Connection cmdlet is used to ping a computer name, the ProtocolAddress property is displaying the resolved ip address (in IPV4Address and ProtocolAddress properties).
PS> Test-Connection -ComputerName PC1 -Count 1 | ft -a
Source Destination IPV4Address IPV6Address Bytes Time(ms)
PC2 PC1 10.10.10.10 32 0
However, Test-Connection doesn't attempt to resolve IP addresses, this is usually done by setting the ResolveAddressNames
Win32_PingStatus property to TRUE, but there's no way to set it via any parameter of Test-Connection.
Having a switch parameter can solve this and offer another way to resolve ip addresses to names.
PS> Test-Connection -ComputerName PC1 -ResolveAddressNames
Currentl;y we can get then same functionality with this:
PS> Get-WmiObject Win32_PingStatus -Filter "Address='10.10.10.10' and ResolveAddressNames='true'" | ft ResolveAddressNames,ProtocolAddress*
ResolveAddressNames ProtocolAddress ProtocolAddressResolved
True 10.10.10.10 PC1
Product Studio item created by Connect Synchronizer due to creation of feedback ID 759607 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=759607).
Internal BugId: 3769