-
Notifications
You must be signed in to change notification settings - Fork 0
/
win-net-info.ps1
21 lines (17 loc) · 1 KB
/
win-net-info.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ErrorActionPreference = 'SilentlyContinue'
Write-Output ""
Write-Output "***** Public/WAN IP Address *****"
#(nslookup myip.opendns.com resolver1.opendns.com | Select-String "Address: ").ToString().Replace("Address: ","")
#(nslookup myip.opendns.com resolver1.opendns.com | Select-String "Address: " | Select-Object -Last 1).ToString().Replace("Address:","").Trim()
(Invoke-WebRequest https://ifconfig.me/ip).Content.Trim()
#https://ipinfo.io/ip
#https://ifconfig.me/ip
#https://icanhazip.com
#https://ident.me
#http://smart-ip.net/myip
Write-Output ""
Write-Output "***** Private/LAN IP Addresse(s) and Interface(s) *****"
Get-NetIPConfiguration | Get-NetIPAddress | Select-Object -Property InterfaceAlias,IPv4Address,PrefixLength | Where-Object {$_.IPv4Address -NotLike "*169.254*" -And $_.IPv4Address -NotLike $null} | ConvertTo-Json
Write-Output ""
Write-Output "***** Reachable Neighbors *****"
Get-NetNeighbor -AddressFamily IPv4 -State Reachable | Select-Object -Property IPAddress,LinkLayerAddress | ConvertTo-Json