?
Solved

Get Status Of Remote Machine Process

Posted on 2010-01-11
4
Medium Priority
?
337 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
[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
  • 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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