I am trying to figure out a few days why my code is not working.
I have a list of IP addresses in a CSV file. from this list of IP addresses I want to get the computer name. When I do what I get
Throw an exception "GetHostByAddress" with argument "1": "Invalid IP address specified." On line: 3 char: 35 + [System.Net.dns] :: GetHostbyAddress <<<("$ Foo [0]") + CategoryInfo: NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId: DotNetMethodException
Here is an example CSV file and the code used:
CSV file
Value
192.168.0.11
192.168.0.12
192.168.0.13
192.168.0.14
Used code:
$foo = import-csv C:\test\test\test.csv
[System.Net.dns]::GetHostbyAddress("$foo[0]")