应该可以试着单看端口是否打开。What port does Remote Desktop use? Does everything go over port 3389?Port 3389 is the only port you need to open. Windows will attempt to stream sound through User Datagram Protocol (UDP) first. If no port is available for UDP, sound will stream through a virtual channel in Remote Desktop Protocol, which uses port 3389.

解决方案 »

  1.   

    好像用ServiceController 好一点。参考:C# Checking if remote desktop is enabled on a windows clientmsdn ServiceController Class
      

  2.   

    ping 目标机器的 3389 端口,如果目标机器的3389端口是有效的则远程桌面服务有可能打开了,如果不通,则肯定没有开;或者你可以使用WMI来观察远程机器上的大部分东西,具体请搜WMI相关资料。但是这样也有限制,要求对方电脑允许WMI访问。 
      

  3.   

    ping 3389 端口不管用的。
    我已经研究出来了 用SOCKET的类tcpclient来判断
     bool tcpListen = false;
                //bool udpListen = false;//设定端口状态标识位
                System.Net.IPAddress myIpAddress = IPAddress.Parse(a);
                System.Net.IPEndPoint myIpEndPoint = new IPEndPoint(myIpAddress, 9009);
                try
                {
                    System.Net.Sockets.TcpClient tcpClient = new TcpClient();
                    tcpClient.Connect(myIpEndPoint);//对远程计算机的指定端口提出TCP连接请求
                    if (tcpClient.Connected == true)
                    {
                        tcpListen = true;
                    }
                }
                catch
                {
                }