Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

前端 未结 16 1990
失恋的感觉
失恋的感觉 2020-12-08 13:32

When I run

Get-WmiObject win32_SystemEnclosure -Computer hostname | select serialnumber

it works for both local and remote hosts.

W

相关标签:
16条回答
  • 2020-12-08 14:04

    I found this blog post which suggested adding a firewall exception for "Remote Administration", and that worked for us on our Windows Server 2008 Enterprise systems.

    http://mikefrobbins.com/2012/03/08/get-wmiobject-the-rpc-server-is-unavailable-exception-from-hresult-0x800706ba/

    0 讨论(0)
  • 2020-12-08 14:04

    I was doing this mistake

    ForEach ($server in $servers) {
    $OS = Get-WmiObject win32_operatingsystem -ComputerName $server
    }
    

    Which, of course, couldn't be passed, because output of the server in a csv file was @{Name=hv1g.contoso.com}

    I had to call the property from csv file like this $server.Name

    ForEach ($server in $servers) {
    $OS = Get-WmiObject win32_operatingsystem -ComputerName $server.Name
    }
    

    It fixed my issue.

    0 讨论(0)
  • 2020-12-08 14:07

    It might be due to various issues.I cant say which one is there in your case.

    Below given reasons may be there:

    • DCOM is not enabled in host PC or target PC or on both.
    • Your Firewall or even your antivirus is preventing the access.
    • Any WMI related service is disabled.

    Some WMI related services are as given:

    • Remote Access Auto Connection Manager
    • Remote Access Connection Manager
    • Remote Procedure Call (RPC)
    • Remote Procedure Call (RPC) Locator
    • Remote Registry

    For DCOM setting refer:

    • Key: HKLM\Software\Microsoft\OLE, Value: EnableDCOM

    The value should be set to 'Y' .

    0 讨论(0)
  • 2020-12-08 14:07

    Below is the native PowerShell command for the most up-voted solution. Instead of: netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes

    Use could use the slightly simpler syntax of:

    Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI-In)"

    0 讨论(0)
  • 2020-12-08 14:08

    Turning the firewall off resolved it for me.

    0 讨论(0)
  • 2020-12-08 14:11

    If you've tried some of the suggestions in the other answers, most notably:

    • David Brabant's answer: confirming the Windows Management Instrumentation (WMI) inbound firewall rule is enabled
    • Abhi_Mishra's answer: confirming DCOM is enabled in the Registry

    Then consider other common reasons for getting this error:

    • The remote machine is OFF
    • You specified an invalid computer name
    • There are network connectivity problems between you and the target computer
    0 讨论(0)
提交回复
热议问题