当使用WMI :

        ConnectionOptions connectionOptions = new ConnectionOptions();
            connectionOptions.Username = userName;
            connectionOptions.Password = password;
            ManagementScope managementScope = new ManagementScope("\\\\" + host + "\\root\\cimv2", connectionOptions);
            try
            {
                managementScope.Connect();
            }
            catch
            {
            }

 发生"RPC 服务器不可用"或者其它无法连接的情况下(确保连接本机没有问题)的解决方案:

1 检查远程服务器 “Remote Procedure Call”、“DCOM Server Process Launcher” 和 “DHCP Client”服务 是否开启

2  检查远程服务器 本地安全策略--本地策略--安全选项--网络访问:本地帐户的共享和安全模式--属性 选择:经典-本地用户以自己的身份验证

3  在远程服务器上,运行"netsh firewall set service RemoteAdmin".

 

posted on 2012-05-23 09:58  寂寞的DBOY  阅读(6950)  评论(1编辑  收藏  举报