/build/static/layout/Breadcrumb_cap_w.png

Quit msi if app running

I'm sure this has been done but I am unable to find it. I need to quit an install if Excel is running. I am using a custom action to determin if excel is running I update a property but am unsure how to stop the install.

0 Comments   [ + ] Show comments

Answers (4)

Posted by: gmorgan618 17 years ago
Blue Belt
0
Can your custom action be run as an immediate action and then use a launch condition to notify the user that excel needs to be closed before attempting the installation?
Posted by: SeaWall 17 years ago
Senior Yellow Belt
0
this is the custom action i wrote in vbscript to check if excel is running.

Dim strComputer, objWMIService, colProcesses, objProcess, running, WshNetwork, objArgs, app
app ="EXCEL.EXE"
strComputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = '" & app & "'")
For Each objProcess in colProcessList
session.Property("EXCELRUNNING") = 1
MsgBox (session.Property("EXCELRUNNING"))
Next

it sets the property correctly I am just not sure how to end the install after checking the property.

yes it run in execute immediate.
Posted by: anonymous_9363 17 years ago
Red Belt
0
You need a Type 19 Custom Action. Check out Custom Action types in MSI.CHM for details.
Posted by: Inabus 17 years ago
Second Degree Green Belt
0
You would make the VBScript into a function that you would then call from a custom action. You would also ensure that the custom action is set to check exit codes. An example of the script is below, this will terminate the MSI installation.

Function ExcelRunning()
Dim strComputer, objWMIService, colProcesses, objProcess, running, WshNetwork, objArgs, app, x
x = 0
app ="EXCEL.EXE"
strComputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = '" & app & "'")
For Each objProcess in colProcessList
x = x + 1
Next
If x >= 1 Then
ExcelRunning = 1602
Else
ExcelRunning = 0
End If
End Function

You return a 0 to the function to continue the installation and a terminated install if you pass a 1602.

-Save the above vbscript to your desktop
-add a new custom vbscript stored in the binary table
-browse to the desktop vbscript
-In "Script Function" enter in ExcelRunning and ensure that return processing is "synchronus(check exit code)"

Hope that makes sense!
Regards,
P
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ