Check Remote Desktop Protocol Port
Test-NetConnection -Computer $Server -CommonTCPPort RDP
Check if Port is Open
$socket = new-object Net.Sockets.TcpClient $socket.Connect($IPAddress,$Port) $socket.Connected
Get External IP Address
Invoke-RestMethod 'https://api.ipify.org?format=json' | Select-Object -ExpandProperty IP