Board index » Visual Studio » How can I detect that a program is running on another computer?

How can I detect that a program is running on another computer?

Visual Studio308
This may not be a VB question but I don't know where else to ask.



How can I detect if a given program is running on another computer on

a LAN?. I have access to the other computer via a shared drive (I can

access its drive in network neighborhood) and I know the program I'm

looking for. What I want to know is whether or not the program is

actually running (like seeing it in the Task Manager).



Is this possible? Either in Windows itself or maybe I could write a VB

program containing some API calls that could detect such a thing?



Any suggestions?


-
 

Re:How can I detect that a program is running on another computer?

WMI can do it Martin. Look for Win32_Process in MSDN (or on the Web)



Tony Proctor



"Martin" <martinvalley@comcast.net>wrote in message

Quote
This may not be a VB question but I don't know where else to ask.



How can I detect if a given program is running on another computer on

a LAN?. I have access to the other computer via a shared drive (I can

access its drive in network neighborhood) and I know the program I'm

looking for. What I want to know is whether or not the program is

actually running (like seeing it in the Task Manager).



Is this possible? Either in Windows itself or maybe I could write a VB

program containing some API calls that could detect such a thing?



Any suggestions?





-

Re:How can I detect that a program is running on another computer?

Randy Birch's VBNet has a couple of routines that almost do what I

want. His "Enumerating services on local & remote machines" does not

show processes other than "services". And, the "List running

processes" works only on the local machine (and does not work on

WinNT).



Randy - if you happen to see this message, can you tell me if there is

any way to combine the features of your routines noted above that

would allow one to list running processes on a remote computer? (one

running XP, 2K or NT)







On Mon, 24 May 2004 16:16:43 -0700, Martin <martinvalley@comcast.net>

wrote:



Quote
This may not be a VB question but I don't know where else to ask.



How can I detect if a given program is running on another computer on

a LAN?. I have access to the other computer via a shared drive (I can

access its drive in network neighborhood) and I know the program I'm

looking for. What I want to know is whether or not the program is

actually running (like seeing it in the Task Manager).



Is this possible? Either in Windows itself or maybe I could write a VB

program containing some API calls that could detect such a thing?



Any suggestions?



-

Re:How can I detect that a program is running on another computer?

Try this



Dim oWMI As Object, oProcess As Object, sServer As String



' ** setup sServer first

Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &

sServer)



For Each oProcess In oWMI.InstancesOf("Win32_Process")

Debug.Print oProcess.Name

Next oProcess





Tony Proctor



"Tony Proctor" <tony_proctor@aimtechnology_NOSPAM_.com>wrote in message

Quote
WMI can do it Martin. Look for Win32_Process in MSDN (or on the Web)



Tony Proctor



"Martin" <martinvalley@comcast.net>wrote in message

news:t005b05i1t1bvnolffhn5bjub6e7qrqbr1@4ax.com...

>This may not be a VB question but I don't know where else to ask.

>

>How can I detect if a given program is running on another computer on

>a LAN?. I have access to the other computer via a shared drive (I can

>access its drive in network neighborhood) and I know the program I'm

>looking for. What I want to know is whether or not the program is

>actually running (like seeing it in the Task Manager).

>

>Is this possible? Either in Windows itself or maybe I could write a VB

>program containing some API calls that could detect such a thing?

>

>Any suggestions?









-

Re:How can I detect that a program is running on another computer?

Tony -



Thanks.



I'm getting a "Can't create object" error at "Set oWMI =...". I've

added a reference to the "Microsoft WMI Scripting V1.1 Library".



I set sServer to the name of the computer I'm trying to access.



What am I missing here?





On Tue, 25 May 2004 14:48:55 +0100, "Tony Proctor"

<tony_proctor@aimtechnology_NOSPAM_.com>wrote:



Quote
Try this



Dim oWMI As Object, oProcess As Object, sServer As String



' ** setup sServer first

Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &

sServer)



For Each oProcess In oWMI.InstancesOf("Win32_Process")

Debug.Print oProcess.Name

Next oProcess





Tony Proctor



"Tony Proctor" <tony_proctor@aimtechnology_NOSPAM_.com>wrote in message

news:emBOWXjQEHA.2468@tk2msftngp13.phx.gbl...

>WMI can do it Martin. Look for Win32_Process in MSDN (or on the Web)

>

>Tony Proctor

>

>"Martin" <martinvalley@comcast.net>wrote in message

>news:t005b05i1t1bvnolffhn5bjub6e7qrqbr1@4ax.com...

>>This may not be a VB question but I don't know where else to ask.

>>

>>How can I detect if a given program is running on another computer on

>>a LAN?. I have access to the other computer via a shared drive (I can

>>access its drive in network neighborhood) and I know the program I'm

>>looking for. What I want to know is whether or not the program is

>>actually running (like seeing it in the Task Manager).

>>

>>Is this possible? Either in Windows itself or maybe I could write a VB

>>program containing some API calls that could detect such a thing?

>>

>>Any suggestions?

>

>





-

Re:How can I detect that a program is running on another computer?

Not sure Martin. Sounds like something not registered on your machine. It

can't be an authorisation problem because you'd get an 'Access denied' error

for that. Also, you don't need anything in your project references as this

bit of quickie code just uses late-binding.



Tony Proctor



"Martin" <martinvalley@comcast.net>wrote in message

Quote
Tony -



Thanks.



I'm getting a "Can't create object" error at "Set oWMI =...". I've

added a reference to the "Microsoft WMI Scripting V1.1 Library".



I set sServer to the name of the computer I'm trying to access.



What am I missing here?





On Tue, 25 May 2004 14:48:55 +0100, "Tony Proctor"

<tony_proctor@aimtechnology_NOSPAM_.com>wrote:



>Try this

>

>Dim oWMI As Object, oProcess As Object, sServer As String

>

>' ** setup sServer first

>Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &

>sServer)

>

>For Each oProcess In oWMI.InstancesOf("Win32_Process")

>Debug.Print oProcess.Name

>Next oProcess

>

>

>Tony Proctor

>

>"Tony Proctor" <tony_proctor@aimtechnology_NOSPAM_.com>wrote in message

>news:emBOWXjQEHA.2468@tk2msftngp13.phx.gbl...

>>WMI can do it Martin. Look for Win32_Process in MSDN (or on the Web)

>>

>>Tony Proctor

>>

>>"Martin" <martinvalley@comcast.net>wrote in message

>>news:t005b05i1t1bvnolffhn5bjub6e7qrqbr1@4ax.com...

>>>This may not be a VB question but I don't know where else to ask.

>>>

>>>How can I detect if a given program is running on another computer on

>>>a LAN?. I have access to the other computer via a shared drive (I can

>>>access its drive in network neighborhood) and I know the program I'm

>>>looking for. What I want to know is whether or not the program is

>>>actually running (like seeing it in the Task Manager).

>>>

>>>Is this possible? Either in Windows itself or maybe I could write a

VB

>>>program containing some API calls that could detect such a thing?

>>>

>>>Any suggestions?

>>

>>

>







-

Re:How can I detect that a program is running on another computer?

"Martin" <martinvalley@comcast.net>wrote in message

Quote
Tony -



Thanks.



I'm getting a "Can't create object" error at "Set oWMI =...".



What OS are you using? Is WMI installed?

http://www.microsoft.com/downloads/details.aspx?FamilyID" rel="nofollow" target="_blank">www.microsoft.com/downloads/details.aspx=afe41f46-e213-4cbf-9c5b-fbf236e0e875&displaylang=en



Quote
I've added a reference to the "Microsoft WMI Scripting V1.1 Library".



That isn't necessary



--

Reply to the group so all can participate

VB.Net... just say "No"



-

Re:How can I detect that a program is running on another computer?

OK, it works if I query a Windows 2000 computer. It doesn't seem to

work against one running NT4 - should it?





On Tue, 25 May 2004 15:17:51 +0100, "Tony Proctor"

<tony_proctor@aimtechnology_NOSPAM_.com>wrote:



Quote
Not sure Martin. Sounds like something not registered on your machine. It

can't be an authorisation problem because you'd get an 'Access denied' error

for that. Also, you don't need anything in your project references as this

bit of quickie code just uses late-binding.



Tony Proctor



"Martin" <martinvalley@comcast.net>wrote in message

news:nbk6b01h7njv475tuue28il10leiahfq3i@4ax.com...

>Tony -

>

>Thanks.

>

>I'm getting a "Can't create object" error at "Set oWMI =...". I've

>added a reference to the "Microsoft WMI Scripting V1.1 Library".

>

>I set sServer to the name of the computer I'm trying to access.

>

>What am I missing here?

>

>

>On Tue, 25 May 2004 14:48:55 +0100, "Tony Proctor"

><tony_proctor@aimtechnology_NOSPAM_.com>wrote:

>

>>Try this

>>

>>Dim oWMI As Object, oProcess As Object, sServer As String

>>

>>' ** setup sServer first

>>Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &

>>sServer)

>>

>>For Each oProcess In oWMI.InstancesOf("Win32_Process")

>>Debug.Print oProcess.Name

>>Next oProcess

>>

>>

>>Tony Proctor

>>

>>"Tony Proctor" <tony_proctor@aimtechnology_NOSPAM_.com>wrote in message

>>news:emBOWXjQEHA.2468@tk2msftngp13.phx.gbl...

>>>WMI can do it Martin. Look for Win32_Process in MSDN (or on the Web)

>>>

>>>Tony Proctor

>>>

>>>"Martin" <martinvalley@comcast.net>wrote in message

>>>news:t005b05i1t1bvnolffhn5bjub6e7qrqbr1@4ax.com...

>>>>This may not be a VB question but I don't know where else to ask.

>>>>

>>>>How can I detect if a given program is running on another computer on

>>>>a LAN?. I have access to the other computer via a shared drive (I can

>>>>access its drive in network neighborhood) and I know the program I'm

>>>>looking for. What I want to know is whether or not the program is

>>>>actually running (like seeing it in the Task Manager).

>>>>

>>>>Is this possible? Either in Windows itself or maybe I could write a

VB

>>>>program containing some API calls that could detect such a thing?

>>>>

>>>>Any suggestions?

>>>

>>>

>>

>





-

Re:How can I detect that a program is running on another computer?

I just tried it against a Windows XP box and I get the "Access denied"

error. Can you tell me what I need to do to get past that?



Thanks again.







On Tue, 25 May 2004 15:17:51 +0100, "Tony Proctor"

<tony_proctor@aimtechnology_NOSPAM_.com>wrote:



Quote
Not sure Martin. Sounds like something not registered on your machine. It

can't be an authorisation problem because you'd get an 'Access denied' error

for that. Also, you don't need anything in your project references as this

bit of quickie code just uses late-binding.



Tony Proctor



"Martin" <martinvalley@comcast.net>wrote in message

news:nbk6b01h7njv475tuue28il10leiahfq3i@4ax.com...

>Tony -

>

>Thanks.

>

>I'm getting a "Can't create object" error at "Set oWMI =...". I've

>added a reference to the "Microsoft WMI Scripting V1.1 Library".

>

>I set sServer to the name of the computer I'm trying to access.

>

>What am I missing here?

>

>

>On Tue, 25 May 2004 14:48:55 +0100, "Tony Proctor"

><tony_proctor@aimtechnology_NOSPAM_.com>wrote:

>

>>Try this

>>

>>Dim oWMI As Object, oProcess As Object, sServer As String

>>

>>' ** setup sServer first

>>Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &

>>sServer)

>>

>>For Each oProcess In oWMI.InstancesOf("Win32_Process")

>>Debug.Print oProcess.Name

>>Next oProcess

>>

>>

>>Tony Proctor

>>

>>"Tony Proctor" <tony_proctor@aimtechnology_NOSPAM_.com>wrote in message

>>news:emBOWXjQEHA.2468@tk2msftngp13.phx.gbl...

>>>WMI can do it Martin. Look for Win32_Process in MSDN (or on the Web)

>>>

>>>Tony Proctor

>>>

>>>"Martin" <martinvalley@comcast.net>wrote in message

>>>news:t005b05i1t1bvnolffhn5bjub6e7qrqbr1@4ax.com...

>>>>This may not be a VB question but I don't know where else to ask.

>>>>

>>>>How can I detect if a given program is running on another computer on

>>>>a LAN?. I have access to the other computer via a shared drive (I can

>>>>access its drive in network neighborhood) and I know the program I'm

>>>>looking for. What I want to know is whether or not the program is

>>>>actually running (like seeing it in the Task Manager).

>>>>

>>>>Is this possible? Either in Windows itself or maybe I could write a

VB

>>>>program containing some API calls that could detect such a thing?

>>>>

>>>>Any suggestions?

>>>

>>>

>>

>





-

Re:How can I detect that a program is running on another computer?



"Martin" <martinvalley@comcast.net>wrote in message



Quote
OK, it works if I query a Windows 2000 computer. It doesn't seem to

work against one running NT4 - should it?



I believe you have to explicitly install WMI on NT 4 boxes.





-

Re:How can I detect that a program is running on another computer?

"Jeff Johnson [MVP: VB]" <i.get@enough.spam>wrote in message

Quote
"Martin" <martinvalley@comcast.net>wrote in message

news:p5m6b05lcaftevtvqvojtb2afoeugcrb14@4ax.com...



>OK, it works if I query a Windows 2000 computer. It doesn't seem to

>work against one running NT4 - should it?



I believe you have to explicitly install WMI on NT 4 boxes.



You need WMI installed to run code on the NT4 box that uses it but I was

under the impression that you could access an NT4 box from another host

using WMI without the target system needing to have it. The only issue I

know of is having sufficient access rights.



--

Reply to the group so all can participate

VB.Net... just say "No"



-

Re:How can I detect that a program is running on another computer?

I wish the target system did not need to have it but it looks like it

does. I downloaded the 6+MB package from MS and installed it on the NT

machine. I can now query that computer just fine.



I still haven't figured out how to get past the "Access denied" error

on an XP unit, though. Can someone shed some light on this for me?



Thanks.



On Tue, 25 May 2004 08:30:41 -0700, "Bob Butler"

<tiredofit@nospam.com>wrote:



Quote
"Jeff Johnson [MVP: VB]" <i.get@enough.spam>wrote in message

news:%23pFIOvmQEHA.2644@TK2MSFTNGP12.phx.gbl

>"Martin" <martinvalley@comcast.net>wrote in message

>news:p5m6b05lcaftevtvqvojtb2afoeugcrb14@4ax.com...

>

>>OK, it works if I query a Windows 2000 computer. It doesn't seem to

>>work against one running NT4 - should it?

>

>I believe you have to explicitly install WMI on NT 4 boxes.



You need WMI installed to run code on the NT4 box that uses it but I was

under the impression that you could access an NT4 box from another host

using WMI without the target system needing to have it. The only issue I

know of is having sufficient access rights.



-

Re:How can I detect that a program is running on another computer?

"Martin" <martinvalley@comcast.net>wrote in message

Quote
I wish the target system did not need to have it but it looks like it

does. I downloaded the 6+MB package from MS and installed it on the NT

machine. I can now query that computer just fine.



Hmmm... guess I've just been lucky so far! Most everything I deal with is

Win2K and the few 9x and NT4 boxes in the mix must have it installed.



Quote
I still haven't figured out how to get past the "Access denied" error

on an XP unit, though. Can someone shed some light on this for me?



If you aren't running as a user that has admin rights then you'll need to

specify a user/password that does. The way I know to do that is to use the

locator object:



Set oLocator = CreateObject("WbemScripting.SWbemLocator")

Set oWMI = oLocator.ConnectServer(hostname, "root\cimv2", username,password)

' then do queries based on the authenticated object

Set oSystem= oWMI.ExecQuery("Select * from Win32_OperatingSystem")





--

Reply to the group so all can participate

VB.Net... just say "No"



-