In a basic MSI project created with InstallShield, creation of the Setup.exe setup launcher is optional. If your build configuration is set up so the MSI database is external to Setup.exe and if the target system has the Windows Installer service present, a user can launch your MSI file directly to initiate the installation.
In some cases, you might want to determine whether the user launched your setup from the setup launcher or from the MSI database. To do this, you can take advantage of the fact that you can define custom public properties at the command line.
For example, run the following command:
msiexec /i product.msi MYPROPERTY=1
It creates a custom property called MYPROPERTY, which will be available for use (for example, in a condition) through the rest of the running installation.
To determine if the installation was launched from Setup.exe, you can specify that Setup.exe should create a property at the command line when it is launched. You can then use the existence of this property to determine if the user launched your setup from the launcher.
To set up the custom property, select the desired release icon in the Releases view and select the MSI Command Line Arguments property, entering:
Inside your setup, the condition:
Will succeed if the user launched Setup.exe, and the condition:
Will succeed if the user ran your setup directly from the MSI database.
One additional recommendation, to handle per-user installations, is that you might want to add your custom property USER_LAUNCHED_SETUPEXE to the SecureCustomProperties property in the Property Manager.
What tips can you add for uncovering how the MSI Setup was launched?
InstallShield® is the world’s leading Windows installation development solution. InstallShield is designed to enable development teams to be more agile, collaborative and flexible when building reliable InstallScript and Windows Installer MSI installations for desktop, server, Web, virtual and traditional applications. The software installer of choice for today’s sophisticated application producers, InstallShield is the only software installer that can directly convert MSIs to Microsoft App-V virtual packages. Get your free trial of InstallShield today or contact us for more information.
InstallAnywhere is the leading multiplatform development solution for application producers who need to deliver a professional and consistent cross installation experience for physical, virtual and cloud environments. From a single project file and build environment, InstallAnywhere creates reliable installations for on-premises platforms – Windows, Linux, Apple OS X, Solaris, AIX , HP-UX, and IBM iSeries – and enables you to take existing and new software products to a virtual and cloud infrastructure and build Docker containers. Get your free trial of InstallAnywhere or contact us for more information.