function IpAddresses ([string]$server) {
$heServer = [system.net.dns]::GetHostEntry($server)
foreach ($curAdd in $heServer.addressList) {
Write-Host ("Address Family: " + ($curAdd.addressfamily).ToString())
if (($curAdd.addressfamily).tostring() -eq [system.net.sockets.addressfamily]::InterNetworkV6) {
Write-Host ("Scope Id: " + $curAdd.ScopeId.ToString())
}
Write-Host ("Address: " + $curAdd.ToString())
$bytes = $curAdd.GetAddressBytes()
Write-Host "AddressBytes: "
for ($i=0; $i -lt $bytes.length; $i++) {
Write-Host $bytes[$i] -NoNewline
}
Write-Host "`r`n"
} # end foreach
} # end functionfunction IPAddressAdditionalInfo() {
Write-Host ("SupportsIPv4: " + ([system.net.sockets.socket]::SupportsIPv4));
Write-Host ("SupportsIPv6: " + ([system.net.sockets.socket]::SupportsIPv6));
if ([system.net.sockets.socket]::SupportsIPv6) {
# Display the server Any address. This IP address indicates that the server
# should listen for client activity on all network interfaces.
Write-Host("IPv6Any: " + [system.net.ipaddress]::IPv6Any.ToString());
# Display the server loopback address.
Write-Host("IPv6Loopback: " + [system.net.ipaddress]::IPv6Loopback.ToString());
# Used during autoconfiguration first phase.
Write-Host ("IPv6None: " + [system.net.ipaddress]::IPv6None.ToString());
Write-Host ("IsLoopback(IPv6Loopback): " + [system.net.ipaddress]::IsLoopback([system.net.ipaddress]::IPv6Loopback));
}
Write-Host ("IsLoopback(Loopback): " + [system.net.ipaddress]::IsLoopback([system.net.ipaddress]::Loopback));
}IPAddresses 'test-pc'
IPAddressAdditionalInfo