Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WMI: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) throws when try to connect to remote machine

Tags:

c#

.net

wmi

I'm using the following code to connect to remote machine using WMI:

   ConnectionOptions connOptions = new ConnectionOptions();
            connOptions.Impersonation = ImpersonationLevel.Impersonate;
            connOptions.EnablePrivileges = true;
            connOptions.Username = "admin";
            connOptions.Password = "password";
            ManagementScope scope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", remoteMachine), connOptions);
            scope.Connect();

I'm getting the following exception: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

Checked all steps described in this knowledgebase article, everything is OK on remote machine.

User is Administrator on remote machine.

Tried Wbemtest tool, the same result

Does anyone has an idea what is happening?

like image 953
vasyl Avatar asked Jan 11 '11 12:01

vasyl


People also ask

What does RPC Server unavailable mean?

The RPC Server is Unavailable error pops up when a Windows computer cannot communicate with other devices on the same network. It may be due to a fault in your firewall settings or interference from third-party software.

How do I know if RPC is enabled?

Alternatively, you can enter “Services” in the search bar. Find “DCOM Server Process Launcher” in the list and double-click to open it. You are now in the configuration menu for the RPC server. Ideally, the “Startup type” should be set to “Automatic” and the “Service status” should show “Running”.

What is the RPC server?

A remote procedural call (RPC) server is a network communication interface that provides remote connection and communication services to RPC clients. It enables remote users or RPC clients to execute commands and transfer data using RPC calls or over the RPC protocol.


2 Answers

If you under Win7 you must run app as an administrator. You can also try different values for connOptions.Impersonation property. Did you open RPC port on a remote machine? Try turning off firewall altogeter on both machines.

like image 92
Nickolodeon Avatar answered Sep 22 '22 07:09

Nickolodeon


Also, You need to enable Windows Management Instrumentation (WMI) rule in windows firewall.

1] Windows Firewall.
2] Allow app or feature through windows firewall.
3] Enable Privilege for Windows Management Instrumentation(WMI).

To enable or disable WMI rule using Windows firewall

  1. In the Control Panel, click Security and then click Windows Firewall.
  2. Click Change Settings and then click the Exceptions tab.
  3. In the Exceptions window, select the check box for Windows Management Instrumentation (WMI) to enable WMI traffic through the firewall.

To disable WMI traffic, clear the check box.

You can also enable or disable WMI traffic through the firewall at the command prompt.

To enable or disable WMI traffic at command prompt using WMI rule group

Use the following commands at a command prompt. Type the following to enable WMI traffic through the firewall.

netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable=yes

Type the following command to disable WMI traffic through the firewall.

netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable=no
like image 36
Rahul Nikate Avatar answered Sep 19 '22 07:09

Rahul Nikate