Tuesday, April 23, 2013

Get running processes. The RPC server is unavailable:



The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)" error may occurs when deploying VNC to a remote computer or when using built-in management tools.
There can be a few reasons for this error:

1. The remote computer is blocked by the firewall.
Solution: Open the Group Policy Object Editor snap-in (gpedit.msc) to edit the Group Policy object (GPO) that is used to manage Windows Firewall settings in

your organization. Open Computer Configuration, open Administrative Templates, open Network, open Network Connections, open Windows Firewall, and then open either 

Domain Profile or Standard Profile, depending on which profile you want to configure. Enable the following exception: "Allow Remote Administration Exception" and 

"Allow File and Printer Sharing Exception".
2. Host name or IP address is wrong or the remote computer is shutdown.
Solution: Verify correct host name or IP address.

3. The "TCP/IP NetBIOS Helper" service isn't running.
Solution: Verity that "TCP/IP NetBIOS Helper" is running and set to auto start after restart.

4. The "Remote Procedure Call (RPC)" service is not running on the remote computer.
Solution: Verity that "Remote Procedure Call (RPC)" is running and set to auto start after restart.
5. The "Windows Management Instrumentation" service is not running on the remote computer.
Solution: Verity that "Windows Management Instrumentation" is running and set to auto start after restart.

 public void GetWMIProcess()
    {

const string Host = "systemname";//ip
        const string Path = (@"\\" + Host + @"\root\CIMV2");
        const string Exe = "notepad";

        var queryString = string.Format("SELECT Name FROM Win32_Process WHERE Name = '{0}'", Exe);
        var query = new SelectQuery(queryString);

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

        var scope = new ManagementScope(Path, options);

        var searcher = new ManagementObjectSearcher(scope, query);

        bool isRunnning = searcher.Get().Count > 0;

        Label1.Text = "Is {0} running = {1}." + Exe + isRunnning;

   }

No comments:

Post a Comment