I have a small problem. This is what I'm running:
VB 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 lstPrograms.Clear 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 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




Reply With Quote