Results 1 to 36 of 36

Thread: Need Help - running process on remote machine

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Question Need Help - running process on remote machine

    I have a small problem. This is what I'm running:

    VB Code:
    1. Function IsProcessRunning(strServer, strProcess)
    2.     Dim Process, strObject
    3.     IsProcessRunning = False
    4.     strObject = "winmgmts://" & strServer
    5.     For Each Process In GetObject(strObject).InstancesOf("win32_process")
    6.     If UCase(Process.Name) = UCase(strProcess) Then
    7.         IsProcessRunning = True
    8.     Exit Function
    9.     End If
    10.     Next
    11. End Function
    12.  
    13.  
    14. Public Sub CheckRunning()
    15.     On Error GoTo errhand
    16.     Dim strComputer, strProcess
    17.     lstPrograms.Clear
    18.     strComputer = lstComputers.Text
    19.         strProcess = "notepad.exe"
    20.     If (IsProcessRunning(strComputer, strProcess) = True) Then
    21.         lstPrograms.AddItem "Notepad" & " " & "is running"
    22.     Else
    23.         lstPrograms.AddItem "Notepad" & " " & "is Not running"
    24.     End If

    This works almost all the time, but I run into an error occassionally if I don't have rights to view the machine. I am the network admin so I have full rights to the system, but occassionally, the system will be unavailable.

    How can I fix this so that if it can't check the computer, it will stop and let me know?

    I keep getting the box saying "Retry" or "Switch" and locks up...

    Thanks in advance for the help
    Last edited by Capp; Jul 26th, 2005 at 07:14 PM.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width