Small question, we're creating an MST for Google Chrome Enterprise and added (In custom Actions) an ExecuteScriptCode action.
With:
Code: Select all
Option Explicit
Dim oFSO,svc,cproc,sQuery,iniproc
Set oFSO = CreateObject("Scripting.FileSystemObject")
Const PROCESSNAME = "setup.exe"
Set svc = GetObject("winmgmts:root\cimv2")
sQuery = "select * from win32_process where name='" & PROCESSNAME & "'"
Set cproc = svc.execquery(sQuery)
iniproc = cproc.Count
If iniproc = 0 Then
DeleteFile("C:\Users\Public\Desktop\Google Chrome.lnk")
Set cproc = Nothing
Set svc = Nothing
wscript.Quit (1)
End If
Do While iniproc => 1
wscript.sleep 5000
Set svc = GetObject("winmgmts:root\cimv2")
sQuery = "select * from win32_process where name='" & PROCESSNAME & "'"
Set cproc = svc.execquery(sQuery)
iniproc = cproc.Count
Loop
Set cproc = Nothing
Set svc = Nothing
Function DeleteFile(File)
If oFSO.FileExists(File) then
oFSO.DeleteFile(File)
End if
End Function
Any tips or tricks?
Cheers, Frank