hnlogoboss

Get-wmiobject : The Rpc Server Is Unavailable. (exception From Hresult: 0x800706ba)

  1. Get Wmiobject Rpc Unavailable 0x800706ba

To simplify your tech training journey, we are consolidating our learning resources and retiring Microsoft Virtual Academy on June 10, 2019. On that date, the full site and all courses are retiring.

When I run

it works for both local and remote hosts.

When I do this for a list of hosts using

it returns

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

Adi Inbar
9,27910 gold badges41 silver badges63 bronze badges
user1501778user1501778

15 Answers

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:

Greg Bray
10k8 gold badges62 silver badges89 bronze badges
David BrabantDavid Brabant
29.2k10 gold badges67 silver badges88 bronze badges

Your code probably isn't using a correct machine name, you should double check that.

Your error is:

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

Get Wmiobject Rpc Unavailable 0x800706ba

This is the result you get when a machine is not reachable. So the firewall suggestions are reasonable, but in this case probably not correct because you say this works:

So in your case it seems when this line is executed:

$_ doesn't contain a proper computer name. You could check type and contents of $_. Probably there is a problem with the file contents. If the file looks right, then maybe the lines are not properly terminated. Maybe take a closer look using Write-Host:

jimharkjimhark
4,2471 gold badge18 silver badges22 bronze badges

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: HKLMSoftwareMicrosoftOLE, Value: EnableDCOM

The value should be set to 'Y' .

Alessio Cantarella
2,2473 gold badges15 silver badges25 bronze badges
Abhishek_MishraAbhishek_Mishra
3,3883 gold badges18 silver badges36 bronze badges

I was having the same problem but only with a few machines. I found that using Invoke-Command to run the same command on the remote server worked.

So instead of:

Use this:

sxm1972sxm1972

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.

AlanAlan
2,7972 gold badges29 silver badges51 bronze badges

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
Twisty ImpersonatorTwisty Impersonator

Solved.

I was running into the exact same error message when trying to execute the following script (partial) against a remote VM that was configured to be in the WORKGROUP.

I noticed I could run the script from another VM in the same WORKGROUP when I disabled the firewall but still couldn't do it from a machine on the domain. Those two things along with Stackflow suggestions is what brought me to the following solution:

Note: Change these settings at your own risk. You should understand the security implications of these changes before applying them.

On the remote machine:

  • Make sure you re-enable your Firewall if you've disabled it during testing.
  • Run Enable-PSRemoting from PowerShell with success
  • Go into wf.msc (Windows Firewall with Advanced Security)
  • Confirm the Private/Public inbound 'Windows Management Instrumentation (DCOM-In)' rule is enabled AND make sure the 'Remote Address' property is 'Any' or something more secure.
  • Confirm the Private/Public inbound 'Windows Management Instrumentation (WMI-In)' rule is enabled AND make sure the 'Remote Address' property is 'Any' or something more secure.

Optional: You may also need to perform the following if you want to run commands like 'Enter-PSSession'.

  • Confirm the Private/Public inbound 'Windows ManagementInstrumentation (ASync-In)' rule is enabled AND make sure the'Remote Address' property is 'Any' or something more secure.
  • Open up an Inbound TCP port to 5985

IMPORTANT! - It's taking my remote VM about 2 minutes or so after it reboots to respond to the 'Enter-PSSession' command even though other networking services are starting up without problems. Give it a couple minutes and then try.

Side Note: Before I changed the 'Remote Address' property to 'Any', both of the rules were set to 'Local subnet'.

GrayDwarfGrayDwarf
8821 gold badge12 silver badges18 bronze badges

I was having the same issue using foreach. I saved the list to $servers and used this which worked:

Computerwudzik
18.7k12 gold badges68 silver badges89 bronze badges
EricEric

Enabling following FW rules on target system resolved the problem on Win2k16:

  • Windows Management Instrumentation (WMI-In)
  • Distribiuted Transaction Coordinator (RPC)
  • Distribiuted Transaction Coordinator (RPC-EPMAP)
General Failure
1,6002 gold badges13 silver badges35 bronze badges
TreborTrebor
Ayan MullickAyan Mullick

Thought I would add that we also ran into this issue with multiple machines in our domain. I created a list of offending machines and added them all to a text file from which to run the script. I ran this from the CMD prompt using elevated privileges.

StuartLC
85.2k15 gold badges148 silver badges210 bronze badges
hungry4pwrhungry4pwr

I faced the simillar issue on new server that I built through automated scripts via vcenter api. Looks like the 'Remote Procedure Call (RPC)' service may not be running on the remote machine. you need to wait for the service to come up to use the Get-WmiObject command. Hence I simply put the script into sleep for sometime and it worked.

RajaVRajaV

I had same issue, and for me, I was trying to use an IP Address instead of computer name. Just adding this as one more potential solution for people finding this down the road.

NealWaltersNealWalters
5,93629 gold badges91 silver badges169 bronze badges

I just came to the exact same issue and found the answer here: http://powershellcommunity.org/Forums/tabid/54/aft/7537/Default.aspx

I had space characters at the end of each line the input file. If your file does too, just remove them and your script should work.

Devon_C_Miller
14.9k2 gold badges34 silver badges63 bronze badges
Anthony HoussaAnthony Houssa

I was doing this mistake

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 Texas legislature session 2019 therapy.

It fixed my issue.

Jan NevařilJan Nevařil

Not the answer you're looking for? Browse other questions tagged powershell or ask your own question.