locked
Problem on using "Process.Response" cannot retrieve the Response result on Remote VB6 Application. RRS feed

  • 問題

  • Hi

    I am making an application to check if the program on the remote machines is still running. I did some research online and it said I can use Process.GetProcessesByName("Process Name", "ComputerName")
    to retrieve the process and to use Process.Response to check the status of the process. Unforunately I have receive the following error when I run the code "Feature not supported on Remote machine".


    Could you give me some advice, is there any way I could check if the program that running on the other machine is still running properly? I am using VB.net 2005 to check a VB6 application.

    Thanks in advance.
    2008年5月12日 下午 02:48

解答

所有回覆

  • Hi Chi,

     

    You may try to set the credentials to remote machine by using ConnectionOptions, FYI:

     

    Regards,

    Colt

     

    2008年5月13日 上午 02:22
  • Hi Colt

    Thanks for your information. I will try it out later, and let you know if my issue have been solved or not.

    Many thanks
    2008年5月13日 上午 07:26
  • Have u solved it yet?

    2008年5月29日 上午 04:22
  • Hi Ken

    I am sorry, I have not solve the problem yet, because I am working on something else at the moment, Hopefully I will do it over weekend.
    I will post again, when I tested it out. Sorry about the delay.

    Many thanks
    2008年5月29日 上午 07:19
  • Hi

    I have tried it out, it works quite well
    except a part which is used to retrive the process , I am not quite sure how to convert it properly on VB.NET


     for (int i = 0; i < split.Length; i++)
    {
    if (splitIdea.Split('=').Length > 1)
    {
    // Extract the right name of the process
    string []procDetails = splitIdea.Split('=');
    procDetails[1] = procDetails[1].Replace(@"
    """, "");
    procDetails[1] = procDetails[1].Replace(';', ' ');
    switch (procDetails[0].Trim().ToLower())
    {
    case "
    caption":
    dr[dc[0]] = procDetails[1];
    break;
    case "
    csname":
    dr[dc[1]] = procDetails[1];
    break;
    case "
    description":
    dr[dc[2]] = procDetails[1];
    break;
    case "
    name":
    dr[dc[3]] = procDetails[1];
    break;
    case "
    priority":
    dr[dc[4]] = procDetails[1];
    break;
    case "
    processid":
    dr[dc[5]] = procDetails[1];
    break;
    case "
    sessionid":
    dr[dcDevil] = procDetails[1];
    break;
    }
    }
    }
    dt.Rows.Add(dr);


    }



    Instead of retrieving a value "Caption" after the Split method, i receive
    " instance of Win32_Process{   Caption"

    is there any way I could work around it?

    here it is my version of the code above in VB.NET

     For Each managementObj As ManagementObject In objSearcher.Get
                    Dim caption As String = managementObj.GetText(TextFormat.Mof)
                    Dim split() As String = caption.Split(separator, StringSplitOptions.RemoveEmptyEntries)
                    Dim dRow = tbl_Process.NewRow

                    For i As Int32 = 0 To split.Length - 1
                        If split(i).Split("=").Length > 1 Then
                            'Extract the right name of the process
                            Dim processDetails() As String = split(i).Split("="c)
                            processDetails(1) = processDetails(1).Replace("""", "")
                            processDetails(1) = processDetails(1).Replace(";"c, " "c)
                            Select Case (processDetails(0).Trim().ToLower)
                                Case "caption"
                                    dRow(dc_Process(0)) = processDetails(1)
                                Case "csname"
                                    dRow(dc_Process(1)) = processDetails(1)
                                Case "description"
                                    dRow(dc_Process(2)) = processDetails(1)
                                Case "name"
                                    dRow(dc_Process(3)) = processDetails(1)
                                Case "priority"
                                    dRow(dc_Process(4)) = processDetails(1)
                                Case "processid"
                                    dRow(dc_Process(5)) = processDetails(1)
                                Case "sessionid"
                                    dRow(dc_Process(6)) = processDetails(1)



                            End Select
                        End If
                    Next


    Could your please give me some advice about what have i done wrong, so that i can make it works on my VB application

    Thanks in advance.
    2008年5月30日 上午 08:37
  • Hi

    Finally I am able to convert the program into VB.Net.
    I have another question. Although I can start a process from a remote computer, Is there any way I could start up a application remotely as well?
    I am not sure able to start a process is same as start an application. The User interface of the application has been disappear.

    Thanks in advance.

    Chi
    2008年7月27日 上午 09:32
  •  ChiYau wrote:
    The User interface of the application has been disappear.


    Yes, I tried something similar in the past, and the only reason I searched is that the application is running in different session than the current logon user in your remote machine, so you 'start' the process remotely but still can't see it visually. However, it'd be another design issue because you're trying to pop up an application or do something remotely.. or even want to display to remote users. We have another name for this kind of operation - virus attack.

    Regards,
    Colt
    2008年7月28日 上午 02:44
  • Hi Colt

    Thanks for your information.
    I am not trying to make a virus attack. Just would like to create a program to reset a application on the remote machine. (Server)

    My Situation is to I have a program to process data E.g. Every 20 mins. Unfortunately the program sometime crashed, therefore I would like to create another program to check if the program crashed, then it will reset the program which process the data. So that I do not need to do it manually.

    A reason that I do not place that Monitoring program into the same server is: If the server reset itself or has been shutdown. It will email me to say the Server is not LIVE or something.

    Could you give me some suggestion. Is there any way that I could do that?

    Thanks in advance.
    2008年7月28日 上午 07:26