[AccessD] A2003: Testing if a Service or an EXE is Running on another machine

Darren - Active Billing darren at activebilling.com.au
Wed Mar 29 20:18:38 CDT 2017


Hi Guys,

Old Windows boxes – Mix of Server 2003 and XP.I have found some scripting to tell me if an executable is running on my local machine.

Works great – However, I am unable to get it to interrogate a different machine without err. Errors usually relate to permissions

Scoured the googles and have tried various things, all to no avail. Has anyone successfully got this to work from Access?

I also want to test is “services” are running on other machines, too. Would appreciate assistance with that too

Many thanks in advance

 

Here’s an example of working code interrogating the local machine for an Executable. But fails when I pass a machine name or IP Address.

 

Function f_IsExeRunning(strExeName As String, Optional strComputer As String = ".") As Boolean

On Error GoTo Err_

   Dim objProcesses    As Object

    Set objProcesses = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2").ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & strExeName & "'")

    If objProcesses.Count <> 0 Then f_IsExeRunning = True

Exit_:

    On Error Resume Next

    Set objProcesses = Nothing

    Exit Function

Err_:

    MsgBox Err.Number & " " & Err.Description, vbCritical, "An Error has Occured"

    Resume Exit_

End Function



More information about the AccessD mailing list