Identifying IP Owners

Listen to this blog post!

Table of contents:

When managing networks, you may encounter unknown IPaddresses. In such cases, it is crucial to quickly identify their owners. Oneway to do this is by querying the IP registration.

There is no built-in cmdlet for this, but with a quickcustom function—and the help of a free web service—you can create such acommand:

function Get-IPAddressRegistration
{
  param
  (
    [Parameter(Mandatory, ValueFromPipeline)]
    [string]
    $IpAddress
  )
  
  process
  {
    Invoke-RestMethod -Uri "http://ipinfo.io/$IpAddress/json" -UseBasicParsing |
      Select-Object -Property Ip, HostName, Org, @{N='Location';E={$_.city, $_.region, $_.country -join ','}}
  }
}

Next time you encounter an unknown IP address, simply query it:

PS C:\> Get-IPAddressRegistration 3.124.231.171

ip            hostname              org                      Location                  
--            --------              ---                      --------                  
3.124.231.171 bremen.jweiland.cloud AS16509 Amazon.com, Inc. Frankfurt am Main,Hesse,DE 

You can also query multiple addresses at once:

PS C:\> '8.8.8.8', '1.1.1.1', '3.124.231.171' | Get-IPAddressRegistration

ip            hostname              org                      Location                   
--            --------              ---                      --------                   
8.8.8.8       dns.google            AS15169 Google LLC       Mountain View,California,US
1.1.1.1       one.one.one.one       AS13335 Cloudflare, Inc. Brisbane,Queensland,AU     
3.124.231.171 bremen.jweiland.cloud AS16509 Amazon.com, Inc. Frankfurt am Main,Hesse,DE  

Note that the underlying free web service has a throttle limit. If you need to query large numbers of IP addresses in a short period, you may need to switch to the paid tier.

Related links