zoukankan      html  css  js  c++  java
  • The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

    在用powershell运行脚本调用WMI远程启动机器的时候碰到的:

    "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)" error may occurs when deploying VNC to a remote computer or when using built-in management tools.
    There can be a few reasons for this error:

    The remote computer is blocked by the firewall.
    Solution: Open the Group Policy Object Editor snap-in (gpedit.msc) to edit the Group Policy object (GPO) that is used to manage Windows Firewall settings in your organization. Open Computer Configuration, open Administrative Templates, open Network, open Network Connections, open Windows Firewall, and then open either Domain Profile or Standard Profile, depending on which profile you want to configure. Enable the following exception: "Allow Remote Administration Exception" and "Allow File and Printer Sharing Exception".
    Host name or IP address is wrong or the remote computer is shutdown.
    Solution: Verify correct host name or IP address.
    The "TCP/IP NetBIOS Helper" service isn't running.
    Solution: Verity that "TCP/IP NetBIOS Helper" is running and set to auto start after restart.
    The "Remote Procedure Call (RPC)" service is not running on the remote computer.
    Solution: Verity that "Remote Procedure Call (RPC)" is running and set to auto start after restart.
    The "Windows Management Instrumentation" service is not running on the remote computer.
    Solution: Verity that "Windows Management Instrumentation" is running and set to auto start after restart.

    第一个解决方法基本可以解决问题的。下面是调用WMI远程重启机器的脚本

    # Define input parameters
    param (
      [string] $filename = $(throw "Filename is required!")
    )
    
    Write-Host "Reading computer names from $filename"
    
    # Read file
    $computers = get-content $filename
    
    write-Host "Restarting computers:"$computers
    
    foreach ($computer in $computers) 
    {
    
      # Connect to WMI
      $wmi = get-wmiobject -class "Win32_OperatingSystem" `
      -namespace "root\cimv2" -computer $computer
    
      # Add privileges
      #$wmi.psbase.Scope.Options.EnablePrivileges = $true
    
    
      # Restart computer
      foreach ($item in $wmi) {
        $wmi.reboot()
        write-host "Restarted " + $computer
      }
    }
    
  • 相关阅读:
    微支付开发(.net)
    微信公众平台开发(一) 配置接口
    [040] 微信公众帐号开发教程第16篇-应用实例之历史上的今天
    [039] 微信公众帐号开发教程第15篇-自定义菜单的view类型(访问网页)
    [038] 微信公众帐号开发教程第14篇-自定义菜单的创建及菜单事件响应
    [037] 微信公众帐号开发教程第13篇-图文消息全攻略
    【微网站开发】之微信内置浏览器API使用
    .Net(c#)汉字和Unicode编码互相转换
    jquery.uploadify上传文件配置详解(asp.net mvc)
    微信公众平台入门开发教程.Net(C#)框架
  • 原文地址:https://www.cnblogs.com/herbert/p/1759962.html
Copyright © 2011-2022 走看看