powershell

sethayes

·

Get-ISPLocation

·

Powershell

·

Total Size: 493 B

·

·

Created: 7 months ago

·

Edited: 7 months ago

$WebRequest = [System.Net.WebClient]::Create("http://ipinfo.io") $WebRequest.Method = "GET" $WebRequest.ContentType = "json" $Response = $WebRequest.GetResponse() $ResponseStream = $Response.GetResponseStream() $ReadStream = New-Object System.IO.StreamReader $ResponseStream $Data = $ReadStream.ReadToEnd() $a,$ip,$hostname,$city,$state,$country,$location,$postal,$ASN,$j = $data.split("{,}") -replace '["]' $location = $loc1.split(':')[-1] + ", " + $loc2.split(':')[-1] Write-Output $location

1 bit

114 views

Are you sure you want to delete?