?
Solved

Get Status Of Remote Machine Process

Posted on 2010-01-11
4
Medium Priority
?
344 Views
Last Modified: 2012-05-08
I would like to be able to get the status of a certain process.exe that should be running on a networked machine.  How can this be done?  The solution can involve the reporting back via a textbox on my form or a messagebox, does not matter.
0
Comment
Question by:H-SC
  • 2
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
graye earned 2000 total points
ID: 26288909
This can be done via the Process class
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
It would look something like this:

Dim myProcesses As Process() = Process.GetProcessesByName("notepad", remoteMachineName)
If myProcesses.Length = 0 Then
     Console.WriteLine("Could not find notepad processes on remote computer.")
End If

For Each myProcess as Process In myProcesses
    Console.WriteLine("Process Name : " & myProcess.ProcessName & "  Process ID : " & myProcess.Id & "  StartTime: " & myProcess.StartTime.ToString)
Next

Open in new window

0
 
LVL 1

Author Comment

by:H-SC
ID: 26293160
graye,
This is perfect!!  Many thanks
0
 
LVL 1

Author Comment

by:H-SC
ID: 26303458
graye,

Hi,
quick follow-up to this one..... I am getting an error of "could not connect to remote computer",  which is ok, because in some cases the machine will not be turned on/offline.  Can I incorporate some kind of catch for that, In other words look for the machine to be out there first then look for the proc..?

0
 
LVL 41

Expert Comment

by:graye
ID: 26303724
This error is a very low-level thing...  it's really a Remote Procedure Call (RPC) error.  It takes about 30 seconds for the RPC to time out (and then generate thay error).  So, to speed things up, I typically try to ping the remote PC first.   A ping typically takes about 1 second to determine if the remote PC is alive and well.   If the ping suceeds, then I go the next step of actually doing any remote activities.
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx 
 
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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses

599 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