I am writing a piece of code that checks for a certain process running (in this case it is an upgrade to the MSI engine). I want the code to loop until the process has completed but i'm unsure of how to do this, this is what i have so far;
--------------------------------------------
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strChkProcess
strComputer = "."
strChkProcess = "'KB893803.exe'"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strChkProcess )
For Each objProcess in colProcess
' i need some sort of loop on this last part until
' the process is no longer running
--------------------------------------------
Help appreciated
--------------------------------------------
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strChkProcess
strComputer = "."
strChkProcess = "'KB893803.exe'"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strChkProcess )
For Each objProcess in colProcess
' i need some sort of loop on this last part until
' the process is no longer running
--------------------------------------------
Help appreciated