Try
$myResultSet | Select-Object -First 1 IPAddress
Your result set is a collection of some type. The Select-Object
cmdlet is taking the first item in that collection and then filtering to only the IPAddress
property which is then displayed.
On my machine the output of the above command looks like this. Yours will likely differ in that the address returned will be different
IPAddress
---------
fe80::5581:4fbc:fc22:ec79%13
You get the table because by default PowerShell puts the output through Format-Table
to make a nice display.
To access just the IP address itself you can modify the expression slightly:
$myResultSet.IPAddress|Select-Object -First 1
or, by using dot notation and an index into the collection you can avoid using Select-Object
entirely like so:
$myResultSet[0].IPAddress
The above refers directly to the IPAddress
property of the first item in the $myResultSet
collection, which has an index of zero hence $myResultSet[0]
Either of these will return just the IP address itself like so:
fe80::5581:4fbc:fc22:ec79%13
IPAddresses
the piece of a tuple already, so you can't break it down further than that.