Listing all IP addresses on your Windows machine is very easy, this is quickly done on Windows.
Use this extra parameter to exclude the loopback addresses.
| Where-Object { $_ -NotMatch "::1" -and $_ -Notmatch "127.0.0.1"} |
How to match and exclude certain strings from Powershell output.
PS C:\Users\Intel i5> (Get-NetIPAddress -AddressFamily ipv4,ipv6).IPAddress | Where-Object { $_ -NotMatch "::1" -and $_ -Notmatch "127.0.0.1"} fe80::e17:b161:498d:a33f%22 fe80::468b:567e:61be:d8fc%19 fdc8:1451:5fa9:4700:f03b:3dfc:b8b3:2e19 fdc8:1451:5fa9:4700:62d0:eed2:a2d8:563a 172.23.176.1 192.168.1.5 |
I am getting all IP addresses on a Windows machine using Powershell.
List the interface names of all network interfaces in the computer, excluding Loopback devices again.
PS C:\Users\Intel i5> (Get-NetIPAddress -AddressFamily ipv4,ipv6).InterfaceAlias | Where-Object { $_ -NotMatch "Pseudo" -and $_ -Notmatch "Loopback"} vEthernet (WSL) Ethernet Ethernet Ethernet vEthernet (WSL) Ethernet |
Display only certain items in a list with Powershell.
PS C:\Users\Intel i5> (Get-NetIPAddress -AddressFamily ipv4,ipv6).IPAddress[0,1,2,3] | Where-Object { $_ -NotMatch "::1" -and $_ -Notmatch "127.0.0.1"} fe80::e17:b161:498d:a33f%22 fe80::468b:567e:61be:d8fc%19 fdc8:1451:5fa9:4700:f03b:3dfc:b8b3:2e19 fdc8:1451:5fa9:4700:62d0:eed2:a2d8:563a |
This displays only the first second and third options in the list of network devices.
(Get-NetIPAddress -AddressFamily ipv4,ipv6).IPAddress[0,1,2,3] |
This will show all of them.
PS C:\Users\Intel i5> (Get-NetIPAddress -AddressFamily ipv4,ipv6).IPAddress[0,1,2,3,4,5,6,7] | Where-Object { $_ -NotMatch "::1" -and $_ -Notmatch "127.0.0.1"} fe80::e17:b161:498d:a33f%22 fe80::468b:567e:61be:d8fc%19 fdc8:1451:5fa9:4700:f03b:3dfc:b8b3:2e19 fdc8:1451:5fa9:4700:62d0:eed2:a2d8:563a 172.23.176.1 192.168.1.5 |