Check if Port is Open
$socket = new-object Net.Sockets.TcpClient
$socket.Connect($IPAddress,$Port)
$socket.Connected
Details
Just supply an IP Address and Port number and it will return true or false, based on if it was able to connect.
  
Check Remote Desktop Protocol Port
Test-NetConnection -Computer $Server -CommonTCPPort RDP
Details
Using the Test-NetConnection cmdlet you can confirm that a server is reachable via the standard RDP port of 3389.

Example
PS C:\> $Server = 'AD01'
>> Test-NetConnection -Computer $Server -CommonTCPPort RDP



ComputerName     : DC01
RemoteAddress    : 10.10.5.12
RemotePort       : 3389
InterfaceAlias   : vEthernet (External (NIC))
SourceAddress    : 10.10.5.200
TcpTestSucceeded : True


  
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 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}

  |  
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 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

  |