Skip to content

Instantly share code, notes, and snippets.

@KelvinTegelaar
Last active October 18, 2020 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KelvinTegelaar/11166da33be4fc73a16c8a3b3cf5fe2d to your computer and use it in GitHub Desktop.
Save KelvinTegelaar/11166da33be4fc73a16c8a3b3cf5fe2d to your computer and use it in GitHub Desktop.
$IPList = @(
"1.1.1.1"
"2.2.2.2"
"3.3.3.3"
"4.4.4.4"
)
$LocationInfo = foreach ($ip in $IPList) {
$Location = (Invoke-restmethod -method get -uri "https://ip2c.org/$($ip)") -split ';' | Select-Object -Last 1
[PSCustomObject]@{
IP = $IP
Location = $Location
}
}
$LocationInfo | Export-Csv -Path C:\Temp\CSV.CSV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment