Update list-ip-addresses.ps1

This commit is contained in:
Markus Fleschutz 2024-07-23 17:40:32 +02:00
parent 5adca7f5dd
commit 52a502cc5a

View File

@ -5,7 +5,7 @@
This PowerShell script queries all IP address information and prints it.
.EXAMPLE
PS> ./list-ip-addresses.ps1
Public IP address 185.72.229.161, 2003:f2:6128:fd01:e543:601:30c2:a028 near Munich, Germany
Public IP 185.72.229.161, 2003:f2:6128:fd01:e543:601:30c2:a028 near Munich, Germany
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -26,7 +26,7 @@ function WriteLocalInterface($interface) {
}
}
if ($IPv4 -ne "" -or $IPv6 -ne "") {
Write-Host "✅ Local $interface IP address $IPv4/$prefixLen, $IPv6"
Write-Host "✅ Local $interface IP $IPv4/$prefixLen, $IPv6"
}
}
@ -51,7 +51,7 @@ try {
if ("$publicIPv6" -eq "") { $publicIPv6 = "no IPv6" }
if ("$city" -eq "") { $city = "unknown city" }
if ("$country" -eq "") { $country = "unknown country" }
Write-Host "✅ Public IP address $publicIPv4, $publicIPv6 near $city, $country" ; if ($country -eq "Russia") { Write-Host -foregroundColor red "DON'T TRUST PUTIN !!! FLEE NOW OR DIE AS SOLDIER IN UKRAINE !!!" }
Write-Host "✅ Public IP $publicIPv4, $publicIPv6 near $city, $country"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"