Get Your Local IP Address
Get-NetIPAddress
Details
Get-NetIPAddress returns the all the local IP addresses of the machine it is run on.

Example
PS C:\> Get-NetIPAddress


IPAddress         : 10.10.1.10
InterfaceIndex    : 12
InterfaceAlias    : Ethernet
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Preferred
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

  |  
Get External IP Address
Invoke-RestMethod 'https://api.ipify.org?format=json' | Select-Object -ExpandProperty IP
Details
Uses the ipify API to return your external IP address

Example
PS C:\> Invoke-RestMethod 'https://api.ipify.org?format=json' | Select-Object -ExpandProperty IP

72.30.35.10
  |  
Get IP from Host Name
[System.Net.Dns]::GetHostAddresses($ServerName)
Details
Get the IP address based on the host name

Example
PS C:\> $ServerName = 'DC01'
>> [System.Net.Dns]::GetHostAddresses($ServerName)



Address            : 167840266
AddressFamily      : InterNetwork
ScopeId            :
IsIPv6Multicast    : False
IsIPv6LinkLocal    : False
IsIPv6SiteLocal    : False
IsIPv6Teredo       : False
IsIPv4MappedToIPv6 : False
IPAddressToString  : 10.10.1.10


  |  
Get Host Name from IP
[System.Net.Dns]::GetHostbyAddress($IPAddress) 
Details
Get the host name from an IP address

Example
PS C:\> $IPAddress = "8.8.8.8"
>> [System.Net.Dns]::GetHostbyAddress($IPAddress)


HostName                       Aliases AddressList
--------                       ------- -----------
google-public-dns-a.google.com {}      {8.8.8.8}

  |