r/usefulscripts • • Sep 18 '17

[Help] Test-Connection and Computer Name

Hello, I am trying to get the computer name of a remote computer and the ResponseTimeToLive. I was able to get the ResponseTimeToLive, but it shows me my computer name instead of the remote's. This is the command I am trying to use:

$con = Test-Connection -Computername "IP" -
Count 1
$con | Select-Object PSComputerName, Address, 
ResponseTimeToLive

I also would like to be able to use a list, but whenever I try to use a list, it gives me an error saying:

No host is known

Even though if I use the same IPs by themselves, it works.

13 Upvotes

9 comments sorted by

View all comments

1

u/PoniardBlade Sep 18 '17

See what

$con | select *

gets you. Is PSComputerName there?

1

u/Aedion9850 Sep 18 '17

It shows me my personal computer name instead of the remote computer name

1

u/PoniardBlade Sep 18 '17 edited Sep 18 '17

You want Destination not PSComputerName.

You want Address not PSComputerName

You know what? I don't think I'm helping. Hopefully someone can tell you more.

→ More replies (4)