首页 新闻 会员 周边 捐助

使用wmi连接远程机子的时候为什么提示“RPC服务器不可用”

0
悬赏园豆:30 [已关闭问题]

在公司的局域网连接是可以的。  
但是远程却不行。不知道是什么原因?  
rpc服务是开着的。   请各位大侠帮忙?

ConnectionOptions options =
                     new ConnectionOptions();
            options.Username = "Administrator";
            options.Password = "zxcvbnm";
            //options.Authority = "ntdlmdomain:default";

            ManagementScope scope =
                new ManagementScope(
                    "\\\\59.56.175.35\\root\\cimv2", options);

            try
            {
                scope.Connect();
                ObjectQuery query = new ObjectQuery(
                    "SELECT * FROM Win32_OperatingSystem");
                ManagementObjectSearcher searcher =
                    new ManagementObjectSearcher(scope, query);

                ManagementObjectCollection queryCollection = searcher.Get();
                foreach (ManagementObject m in queryCollection)
                {
                    // Display the remote computer information
                    Console.WriteLine("Computer Name : {0}",
                        m["csname"]);
                    Console.WriteLine("Windows Directory : {0}",
                        m["WindowsDirectory"]);
                    Console.WriteLine("Operating System: {0}",
                        m["Caption"]);
                    Console.WriteLine("Version: {0}", m["Version"]);
                    Console.WriteLine("Manufacturer : {0}",
                        m["Manufacturer"]);
                }
            }
            catch (Exception me)
            {
                Console.WriteLine("异常:" + me.Message);
            }

Humsil Dai的主页 Humsil Dai | 初学一级 | 园豆:130
提问于:2010-01-07 16:16
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册