Click to See Complete Forum and Search --> : Search for running processes on another machine
trisuglow
Feb 20th, 2002, 09:58 AM
I want to check for a running program on another computer (which can be accessed through Network Neighbourhood). I only know the filename of the program.
I've been looking at EnumProcesses, but I'm not sure how to make this do what I want.
I'm developing for NT.
Can anyone help?
JoshT
Feb 20th, 2002, 11:36 AM
It's possible to do this with WMI across a network thru the Win32_Process Class, but you need WMI installed, so if you're running less than Windows 2000 you probably don't have it installed.
trisuglow
Feb 21st, 2002, 04:00 AM
Thanks Josh,
I'm experimenting with the following code. Do you think I'm going to get anywhere? I'm not actually looking for Excel at the end of the day, I want to find out if a program called dl_rp.exe is running.
It's been suggested that I write a server to sit on the remote machines and then interrogate it to find out if dl_rp.exe is running. I'd prefer not to do this because it means ensuring that the end-user installs the server.
I had also started looking at WMI but came to the conclusion that I could spend a lot of time not making it work!
Function GetVersion()
Dim XLApp
Set XLApp = CreateObject("Excel.Application", "Uglow")
GetVersion = XLApp.Version
End Function
Tris.
JoshT
Feb 21st, 2002, 10:57 AM
If this program is not COM / ActiveX, I don't think the CreateObect will work.
There is a utility called pslist.exe available for free at http://www.sysinternals.com that can list processes on a remote computer on an NT network, so there is definately a way to do this via API. However, looking at the program in Depends doesn't really give any API hints.
I found this article while searching, maybe the PSAPI.DLL can work remotely? http://support.microsoft.com/default.aspx?scid=kb;EN-US;q187913
As for WMI, it's pretty easy to do - add a reference to Microsoft WMI Scripting Library, then go
'Windows Management Instrumentation Objects
Dim wmiLocator As WbemScripting.SWbemLocator
Dim wmiContext As WbemScripting.SWbemNamedValueSet
Dim wmiServices As WbemScripting.SWbemServices
'Hardware object representations
Dim cpu As Object 'cpu
Dim cpus As Object 'collection of cpus
Set wmiLocator = New WbemScripting.SWbemLocator
Set wmiContext = New WbemScripting.SWbemNamedValueSet
On Error GoTo Err_CannotConnect
Set wmiServices = wmiLocator.ConnectServer(strComputer, "root\cimv2", , , , , , wmiContext)
On Error GoTo 0
Set cpus = wmiServices.InstancesOf("Win32_Processor")
For Each cpu In cpus
lstProcessors.AddItem cpu.CurrentClockSpeed & " Mhz"
Next
trisuglow
Feb 22nd, 2002, 11:12 AM
Fantastic!
Thanks Josh, the pslist.exe works great.
I'm having a little trouble running it and capturing the output though. (Not a problem with pslist, just an issue with Shelling it out).
Tris.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.