Re: View running processes of remote machine
- From: "Capp" <Capp@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Jul 2005 06:11:04 -0700
Randy,
Thank you for your reply. I may end up having to take this approach, but
only if I can't get this other way to work. The program I am running first
runs a loop that lists every PC on my network (WAN ~4000 machines). Then Runs
a loop on selected machines to check for running programs I specify.
I am getting the error #462 when it tries to list processes on a machine
that is off, but also on machines I do not have access to. What I mean by
this is, We run a large WAN at our company, but I am only a site network
manager so if I choose any locations outside of my network, it errors out
even when the machine is on.
What I am wanting to do is...If it selects a machine that cannot be
contacted or I do no have rights to, I want it to end the loop and move to
the next machine.
I really appreciate all the help....You've helped me before :)
Capp
"Randy Birch" wrote:
> Let's see if I can explain this properly. When a PC joins a domain, and then
> is shut down, the domain controller(s) does not necessarily know the machine
> has gone offline. So when an enumeration takes place the machine is listed -
> it is after all a member of the domain - but as you've discovered it's not
> until you try and access it that you find it's off (or offline). And I don't
> recall there being any magic solution to this, as it's a common network
> admin issue not confined to VB programming.
>
> I think, rather than try to blindly attempt to enumerate the process on a
> box, you might be further off time-wise if you first took a sec to try and
> ping the box. The code here should get you started on that -
> http://www.vbnet.mvps.org/code/internet/pingbyhostname.htm. Just pass the
> machine name rather than a URL as the demo shows. Depending on your setup it
> may require the domain\machine name or just the machine name alone. On a
> workgroup it only needs the machine name (no slashes). You should be able
> on a local network to get away with setting the PING_TIMEOUT value to much
> less than 500 ms - probably around 100-200 would do. If you get at True
> returned, then call your WMI routine. If false, move on to the next machine.
>
> If the machines are all on the same network, I believe that the
> SocketsInitialize routine only needs to be called on first starting the
> demo, and correspondingly the SocketsCleanup routine on ending, rather than
> for each call to the ping routine (see the Command1_Click code). But these
> are very fast routines, so the overhead of repeated calling is probably not
> significant in the long run - never had an opportunity to test the
> differences.
>
>
> --
>
> Randy Birch
> MS MVP Visual Basic
> http://vbnet.mvps.org/
> ----------------------------------------------------------------------------
> Read. Decide. Sign the petition to Microsoft.
> http://classicvb.org/petition/
> ----------------------------------------------------------------------------
>
>
>
> "Capp" <Capp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:5AEFF330-27E8-4E0E-BDC4-F8300C183EE9@xxxxxxxxxxxxxxxx
> :I have a small problem. This is what I'm running:
> :
> :
> : visual basic
> :
> code:---------------------------------------------------------------------------
> :
> : Function IsProcessRunning(strServer, strProcess)
> : Dim Process, strObject
> : IsProcessRunning = False
> : strObject = "winmgmts://" & strServer
> : For Each Process In GetObject(strObject).InstancesOf("win32_process")
> : If UCase(Process.Name) = UCase(strProcess) Then
> : IsProcessRunning = True
> : Exit Function
> : End If
> : Next
> : End Function
> :
> :
> : Public Sub CheckRunning()
> : On Error GoTo errhand
> : Dim strComputer, strProcess
> : strComputer = lstComputers.Text
> : strProcess = "notepad.exe"
> : If (IsProcessRunning(strComputer, strProcess) = True) Then
> : lstPrograms.AddItem "Notepad" & " " & "is running"
> : Else
> : lstPrograms.AddItem "Notepad" & " " & "is Not running"
> : End If
> : --------------------------------------------------------------------------------
> :
> : This works almost all the time, but I run into an error occassionally. The
> : script I run lists all the pc' on my network (like I want it to). But, it
> : also lists the pc even if it is turned off. The problem I am running into
> is
> : 1) It errors out if it can't connect to the machine, and 2) if It is a
> : machine on a different subnet (WAN), I don't have access to the machine
> and
> : it errors out.
> :
> : It's not giving me a normal error though. It is giving me the error:
> : Title -> Component Request Pending
> : Text -> This application cannot be completed because the other application
> : is busy. Choose 'Switch To' to activate the busy application and correct
> the
> : problem.
> : Options -> Switch To..., Retry
> :
> : No matter what I try, it keeps coming up. I end up having to kill it
> through
> : the task manager.
> :
> : How can I fix this so that if it can't check the computer, it will stop
> : trying and go back to idle without erroring?
> :
> : I tried doing the "On error..." method, but it still craps out on me.
> :
> : Thanks in advance for the help
> :
>
>
.
- References:
- View running processes of remote machine
- From: Capp
- Re: View running processes of remote machine
- From: Randy Birch
- View running processes of remote machine
- Prev by Date: Re: redim preserve multidimen array
- Next by Date: Re: redim preserve multidimen array
- Previous by thread: Re: View running processes of remote machine
- Next by thread: Create a Data Class With Add-Mod-Del Methods Bound to Text Boxes
- Index(es):
Relevant Pages
|