Hi,

I'm triggering an installer (setup.exe) through VBA, and I need to monitor when it's completed running.

The process is running from a USB Flash Drive (E:\), and I can see it through Task Manager.

I thought the following function would tell me if the process was running, but it's not in this list:
Private Function CheckIfRunning() As Boolean
    On Error Resume Next
    Dim objWMIcimv2 As Object, objProcess As Object, objList As Object
    Dim intError As Integer
    CheckIfRunning = False
    'Connect to CIMV2 Namespace and then find the .exe process
    Set objWMIcimv2 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set objList = objWMIcimv2.ExecQuery("select * from win32_process")
    For Each objProcess In objList
        If InStr(1, UCase(objProcess.executablePath), "SETUP.EXE") > 0 Then
            CheckIfRunning = True
            Exit For
        End If
        'Return value is 0 for success. Any other number is an error.
        If intError <> 0 Then Exit For
    Next

    Set objWMIcimv2 = Nothing
    Set objList = Nothing
    Set objProcess = Nothing
End Function
I'm not very familiar with WMI and what it can query (ex. win32_process), so any insight into this method or a different way of determining what is running would be appreciated.