Я использовал следующее как часть WMI:
Public Function WaitForProcess(ProcessName As String, Optional ProcessID As Boolean = False)
' if you dont mind including the reference for Microsoft WMI Scripting V.1.2 Library, uncomment below
' Otherwise, it should work fine without the reference, just no intelasense
UpdateStatus "Starting WaitForProcess function to wait for process: " & ProcessName
Dim strComputer As String
Dim colProcesses
Dim objWMIService
UpdateStatus "Use this computer to see processes on"
strComputer = "."
UpdateStatus "Impersonate this computer"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
UpdateStatus "Get all running processes with a " & IIf(ProcessID = False, "Name", "ProcessID") & " of: " & ProcessName
Set colProcesses = objWMIService.ExecQuery("SELECT * " & _
"FROM Win32_Process " & _
"WHERE " & IIf(ProcessID = False, "Name", "ProcessID") & " = '" & ProcessName & "'")
UpdateStatus "Waiting untill there are no more instances of this process shown in the process list"
Do
DoEvents
' Update the collection of processes returned
Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE " & IIf(ProcessID = False, "Name", "ProcessID") & " = '" & ProcessName & "'")
Loop Until colProcesses.Count = 0
UpdateStatus "The " & IIf(ProcessID = False, "Process Name", "Process ID") & ": " & ProcessName & " concluded successfully. WaitForProcess Completed"
End Function
Это хорошо работает для моего проекта; однако для этого требуется инструментарий управления Windows.