jvsanguyo
Posts: 4
Joined: Wed May 11, 2016 10:37 am

SQL EXPRESS

Is there a way to check if the Instance Name is already installed in the machine? I want to handle that option so that the UI of sql express installation will be skip and continue with the installation.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: SQL EXPRESS

Hello,

Can you please tell us if the SQL Express is added as a feature-based or pre-install prerequisite?

If the Sql is added as a feature-based prerequisite then you can create an SQL Server browse operation to browse the installed SQL servers.

Enable the Put the result into a property option from the SQL Server Browse properties to dump the results in a list separated by comma. You will have to create a custom action to see if the related instance can be found in the list. Here's the How to set an installer property using custom actions? article which may be useful to you.

It seems that an unofficial switch for SQL Server that can be used (from my tests starting with SQL 2012 SP2) to avoid checking if there is another installer running. The flag is:

Code: Select all

/SKIPINSTALLERRUNCHECK=1
A command line for installing silent SQL Server Express 2014 SP1 as a featured-based prerequisite is the following:

Code: Select all

/q /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQLEngine,SSMS /INSTANCENAME=SQLEXPRESS /UpdateEnabled=False/SKIPINSTALLERRUNCHECK=1
However, it seems this only work when the SQL Server prerequisite is included in the main installation package (e.g. it is not used its online location). So, when you add SQL prerequisite from our predefined list of prerequisites and you are prompted if you want to download it, you need to answer YES.

If the prerequisite is added as a Pre-Install prerequisite then this approach will not work. You will have to create a custom action to detect the installed SQL instances and skip prerequisite installation based on the results. You can add your own .EXE to the Prerequisite install conditions tab of the prerequisite. Select the Search done by a custom executable option from the Edit Prerequisite Search Dialog that enables you to specify your own EXE file that will determine whether the prerequisite is installed. The setup will interpret the result based on the return code of your EXE. In case of the EXE finds a suitable version of the prerequisite, the returned value must be 0. Any other value will be interpreted as failure.
You can take a look on the How can I determine installed SQL Server instances and their versions? thread which may be useful to you.

If you need any help, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”