Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set objShell = CreateObject("Wscript.Shell")
KillProcess("'processA.exe'")
KillProcess("'processB.exe'")
KillProcess("'processC.exe'")
strMSI = "MSI2Execute.msi"
On Error Resume Next
objShell.Run objShell.ExpandEnvironmentStrings("%WINDIR%") &"\System32\msiexec /I " &strMSI &" /qb-!",1,true
On Error Goto 0
Sub KillProcess(strProcess)
On Error Resume Next
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcess)
For Each objProcess in colProcess
objProcess.Terminate()
Next
On Error Goto 0
End Sub
|