RPC Unavailable, WMI, c#

I am receiving a rpc server unavailable 800706ba error when trying to connect to a remote PC.

Firewalls are turned off on both machines.  The remote machine is running Windows 7 Pro.

the strange thing is if I go into Explorer and map a drive with the identical user name and password below, it will map fine.  i then disconnect the mapped drive and re-run the code below, and it works.  however, if i reboot the machine, it will give me the same error message.  i then go back into Explorer and repeat the process and it works fine.

any ideas as to why?  I would greatly appreciate any help.

i use the following code:

                ConnectionOptions options = new ConnectionOptions();
                options.Username = "userName";
                options.Password = "password";

                string adsiPath = string.Format(@"\\" + IP + @"\root\cimv2");
                ManagementScope scope = new ManagementScope(adsiPath, options);
                if (!scope.IsConnected)
                    scope.Connect();  // this is where it raises the error

                ObjectQuery oQuery = new ObjectQuery("SELECT * FROM Win32_Service WHERE name = 'serviceName");
                using (ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(scope, oQuery))
                    updateStatus("Found " + oSearcher.Get().Count + " instance(s) of the old sync service.");
Who is Participating?
freezingHotConnect With a Mentor Author Commented:
Router issue.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.