Invoke-xRDS_TestPort.ps1

function Invoke-xRDS_TestPort ($hostname='localhost',$port=5985,$timeout=100) {
      $requestCallback = $state = $null
      $client = New-Object System.Net.Sockets.TcpClient
      $beginConnect = $client.BeginConnect($hostname,$port,$requestCallback,$state)
      Start-Sleep -milli $timeOut
      if ($client.Connected) { $open = $true } else { $open = $false }
      $client.Close()
      [pscustomobject]@{hostname=$hostname;port=$port;open=$open}
    }