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

When I run

Get-WmiObject win32_SystemEnclosure -Computer hostname | select serialnumber

it works for both local and remote hosts.

When I do this for a list of hosts using

ForEach ($_ in gc u:\pub\list.txt) {
    Get-WmiObject win32_SystemEnclosure -Computer $_ | select serialnumber | format-table -auto @{Label="Hostname"; Expression={$_}}, @{Label="Service Tag"; Expression={$_.serialnumber}}
}

it returns

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


Solution 1:

Check that the "Windows Management Instrumentation (WMI-In)" rule is enabled in the firewall for each remote machine.

Or in an Administrative Command/Powershell prompt run:

netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes

Solution 2:

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' .