Monday, May 21, 2012
   
Text Size

Check For a Process completetion before continueing

The following example checks for the 'WFICA32.EXE' process and loops until the process has ended:

 

Wscript.Sleep 5000

set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='wfica32.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count    'it can be more than 1
Do While iniproc = 1
    wscript.sleep 5000
    set svc=getobject("winmgmts:root\cimv2")
    sQuery="select * from win32_process where name='wfica32.exe'"
    set cproc=svc.execquery(sQuery)
    iniproc=cproc.count
Loop
set cproc=nothing
set svc=nothing

 

Please Note: Append to Template.vbs to run this script.