Solved

Check if a process exists on server

Posted on 2006-11-03
3
163 Views
Last Modified: 2009-07-29
How can I check if a process such as cmd.exe exists on \\server. Thanks.
0
Comment
Question by:sandya_116
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
iHadi earned 500 total points
ID: 17870909
Hi Sandya_116

Copy the following function to your project and use it like this: FindProcess("Server", "cmd")

    Private Function FindProcess(ByVal MachineName As String, ByVal ProcessName As String)
        Dim PList() As System.Diagnostics.Process
        Dim Res As Boolean = False

        PList = System.Diagnostics.Process.GetProcesses(MachineName)

        For i As Integer = 0 To PList.Length - 1
            If PList(i).ProcessName = ProcessName Then
                Res = True
                Exit For
            End If
        Next

        If Res = True Then
            MessageBox.Show("Process: """ & ProcessName & """ found on machine: " & MachineName)
        Else
            MessageBox.Show("Process: """ & ProcessName & """ not found on machine: " & MachineName)
        End If
        Return Res
    End Function
0
 
LVL 13

Expert Comment

by:iHadi
ID: 17870957
0
 

Author Comment

by:sandya_116
ID: 17874007
Thanks iHadi. That worked.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question