Do you need to find out if a particular exe file (or a process) is running on local or remote machine? It is very easy to check this out using System.Diagnostics namespace.
According to MSDN:-
The System.Diagnostics namespace provides classes
that allow you to interact with system processes, event logs, and performance
counters.
The Process class provides
functionality to monitor system processes across the network, and to start and
stop local system processes. In addition to retrieving lists of running
processes (by specifying either the computer, the process name, or the process
id) or viewing information about the process that currently has access to the
processor, you can get detailed knowledge of process threads and modules both
through the Process class itself, and
by interacting with the ProcessThread and
ProcessModule
classes. The ProcessStartInfo
class enables you to specify a variety of elements with which to start a new
process, such as input, output, and error streams, working directories, and
command line verbs and arguments. These give you fine control over the behavior
of your processes. Other related classes let you specify window styles, process
and thread priorities, and interact with collections of threads and modules.
Simply speaking, using an object of Process class you can get a list of all processes running on system. Its member GetProcesses provides an array of all processes running on the system. Its overload GetProcesses(strMachineName) allows you to do the same for a machine on the network.
If you need to check a particular process, there is a member GetProcessesByName(strName) using which you can provide the string parameter containing the name of process.
Let's see a coding example. I want to find all processes of "notepad" running on my machine and want to know what time each of them was started. Here is how its done in VB.net.
Imports System.Diagnostics 'put it on top of page
Dim localByName As Process() = Process.GetProcessesByName("notepad")
Dim NotePadProc As Process
MsgBox("Total number of processes found: " & LocalByName.Length)
' if Length property is zero, means no such process running.
For Each NotePadProc In localByName
MsgBox(NotePadProc.StartTime)
Next