ServiceController class error: "Couldn't connect to remote machine." RRS feed

  • Question

  • I have a vb program that does monitor windows services on other remote machines on the same domain. the code does service monitoring correctly without errors for some machines, but it give the following errors for other machines:

    Couldn't connect to remote machine.  
       at System.Diagnostics.NtProcessManager.GetProcessInfos(String machineName, Boolean isRemoteMachine)  
       at System.Diagnostics.ProcessManager.GetProcessInfos(String machineName)  
       at System.Diagnostics.Process.GetProcesses(String machineName)  
       at MyProgram.BlogsMonitor.MyMonitor.startMonitor(). Logged at 11/14/2008 2:15:42 PM  

    To simplify things: the central machine that has the monitoring code is called M1, and it does monitor services on machines A and B.

    I have checked all network settings for machine A(M1 can monitor services on this one) and machine B(M1 can NOT monitor services on this one and gives the error above). All settings are the same.

    M1 can ping machine A and machine B, both by IP and by Name. Also when I run the command line sc on M1 to query / start / stop services on machines A and B, it does work ! ...

    what else can be the issue?

    Friday, November 14, 2008 7:38 PM


  • See if you can access the remote services interactively.

    1.  Log on to the same machine that you are running that program and, if possible, the same user account that your program runs under.
    2.  Start mmc (Microsoft Management Console).
    3.  File, Add/Remove Snap-in.
    4.  Add the Services Snap-in.
    5.  Pick Another computer.  Use the same machine name as was failing in your code.
    6.  See what happens.

    If this doesn't work, it might give you more insight into where the problem lies.
    • Marked as answer by Zhi-Xin Ye Thursday, November 20, 2008 1:16 PM
    Saturday, November 15, 2008 3:33 PM