Link to home
Start Free TrialLog in
Avatar of kaygroth2
kaygroth2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

How to handle: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

I'm working on a little utility in c# to grab data from a bunch of computers on a domain via WMI, i already have a section which find out if the machine is reachable and if it is then it uses WMI to gather the information from the machine.

However,sometimes i'm getting the below exception and im wondering how i should be handling it. The section where the WMI info is retrieved is already in a try catch block, but i want to be able to keep going if this exception occurs.

below is the exception in question:

Unhandled Exception: System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Management.ManagementScope.InitializeGuts(Object o)
   at System.Management.ManagementScope.Initialize()
   at System.Management.ManagementObjectSearcher.Initialize()
   at System.Management.ManagementObjectSearcher.Get()
   at Get_Computer_names.Program.Main(String[] args) in C:\Users\a_user\
Documents\Visual Studio 2010\Projects\program_name\program_name\Program.cs:line 77

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mastoo
mastoo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kaygroth2

ASKER

Thanks mastoo, makes sense, i'll give it a go on Monday :)
Clear and concise answer, Thanks