InstallShield Tips and Techniques

December 26, 2016

Installing SQL Server 2014 Express as Setup Prerequisite

Filed under: Reference Materials — shieldmaster @ 7:14 pm

I needed to create an InstallShield 2016 setup with SQL Server 2014 Express as a Setup Prerequisite. I have done this numerous times with many previous versions of SQL Server (2005, 2008, 2012) so it should have been simple.

 

It wasn’t!

 

I finally got it operational after quite a bit of effort and imagination. I am documenting the issues so that you can follow the requirements to get it operational!

 

 

Issues Encountered

 

I downloaded the available redistributable for SQL Server 2014 Express, and using that
executable, I created the parameters to be passed during silent execution of SQLServer 2014 Express, which can be successfully tested within a BATCH file:

 

 c:\Install\SQLEXPR_x86_ENU.exe /Q /ACTION=”Install” /IACCEPTSQLSERVERLICENSETERMS=”True” /UpdateEnabled=”True” /FEATURES=SQLENGINE,REPLICATION,SSMS,SNAC_SDK /INSTANCENAME=”ShieldMaster” /SECURITYMODE=”SQL” /SQLSVCACCOUNT=”NT AUTHORITY\NETWORK SERVICE” /SQLSVCSTARTUPTYPE=”AUTOMATIC” /SAPWD=”kc7000″ /SQLSYSADMINACCOUNTS=”BUILTIN\ADMINISTRATORS” /TCPENABLED=”1″ /NPENABLED=”1″

 

Then I injected them into the launch parameters for the PRQ files, as shown here:

 

 


 

I downloaded the available redistributable for SQL Server 2014 Express, and proceeded to test its installation as normal. When I initially tested on a Win 10 (64bit), it displayed both the 32bit and 64 bit versions of SQL Server 2014 Express attempting to install – indicating the 32bit had incorrect OS conditions. I fixed the 32bit PRQ to stop it installing on any Win10 operating system and corrected it just install on 32bit systems.

 

Well, as soon as I was able to install it, I encountered a strange error, as shown in the extract from the “SystemConfigurationCheck_Report” :

 

MediaPathLength

Checks whether the SQL Server installation media is too long.

Failed

SQL Server installation media on a network share or in a custom folder can cause installation failure if the total length of the path exceeds 260 characters. To correct this issue, utilize Net Use functionality or shorten the path name to the SQL Server setup.exe file.

 
 

 

On a hunch, I took that the 2016 InstallShield ISM and unchecked SQL Server 2014 and checked SQL Server 2012 Express. I added the silent parameters from the SQL Server 2014 PRQ, and rebuilt the setup.  

 

It work perfectly!!!   It looks like the issue resides with how the Setup Prerequisite has been created.  I opened an incident with InstallShield support and received this email answer:

 

This is actually due to a change in recent SQL installers. Previously, the SQL installer did not extract its files to the location where the setup is located. Now that it does, it will result in the issue where the path is too long causing this issue during silent SQL installs.

 

The workaround that you can do is to create a batch file like so:

@echo off

 

cmd /C start /wait SQLEXPR_x64_ENU.exe /qs /x:”C:\temp\SQLTEMP”

 

C:\temp\SQLTEMP\setup.exe /qs /ACTION=install etc etc etc

 

And then include that batch file in the prerequisite and set the Application to Run as the batch file instead. This way, the prerequisite will launch the batch file instead of the SQL installer directly and will do the above to extract the files to the custom location as specified by /x and then launch that extracted setup.


During my testing, I had noticed that the extracted Setup.exe was embedded deep within the %TEMP% folder, such as “C:\Users\Charles\AppData\Local\Temp\{00B5C96B-7A86-4762-8FF8-C789F53FC1E2}\02CB69A4-ABE6-4ED3-8601-05A0651AACA0”, so now I had a solution.

To compound the issue, the client wanted SQL Server Express 2014 with Tools – which expanded the setup from 279MB to 890MB just for 64bit. I could not set the parameter to extract the Setup Prerequisites from the setup – I needed to have the pulled from the web.

The problem is that when I created the LAUNCH.BAT, and staged it with the file “SQLEXPR_x64_ENU.exe”, and tried to have them downloaded from the web, the two files would not match up correctly.

My solution was to use an old InstallShield tool “PackageForTheWeb” (PFTW) to create a self-extracting executable – which will launch the file “Launch.BAT” upon extraction. This solution kept the two files together so the command file could find the SQL Server executable.

Then the customer wanted to have the SQL Server installed only if they indicated, so I put a customer dialog in which the customer dictated whether the Database Schema was to be installed into a new Express instance, or into an existing SQL Server database instance. (If they choose the latter, I would display the SQLLogin screen). Thus if they wanted to install into a new Express instance, I would trigger the Setup Prerequisite to install as a Feature prerequisite – as shown here:

 


 

Solution

 

So, here is the step by step solution:

Step #1

 

  • Create a batch file containing the following information – in this case it’s for the 32bit version:


 

Step #2

 

  • Stage the batch file in the same directory as the SQL Server 2014 express executable

     

     

Step #3

 

  • Now, I used PFTW to create a self-extracting executable – called it “SQLServer2014Express_86_WT.exe”. This file I moved into the InstallShield directory where the Setup Prerequisites are stored. This directory is:

    C:\Program Files (x86)\InstallShield\2016\SetupPrerequisites\SQLServerExpress\2014\x86

Step #4

 

  • Now I updated the PRQ file to point at this new executable “SQLServer2014Express_86_WT.exe”. I loaded this executable to my website, and modified the Files URL to point to this across the web. I also modified the condition to enable the new Instance to be evaluated “ShieldMaster”.

     


 

Finally a working solution!

 

Hope this helps!

 

ShieldMaster

 

 

 

 

 

 

6 Comments »

  1. Can you give me a link for PFTW?

    Comment by Ben — January 2, 2017 @ 5:43 am

  2. I just did this for SQL Server 2016. But I didn’t use PFTW as I couldn’t find it and 7zip just wasn’t working for me.
    I just added the launch.bat to the pre-requisite. So the pre-requsite now runs the .bat file instead of the exe with the command line parameters..

    Comment by Daniel Brown — February 6, 2017 @ 12:51 am

  3. For the SQL Command lines ensure you have this option or otherwise your installation of SQL Server will hang!
    /SkipInstallerRunCheck
    https://support.microsoft.com/en-au/…ng-application

    Well at least it did with my SQL Server 2016 SP1 Express installation.

    Comment by Daniel Brown — February 6, 2017 @ 8:48 pm

    • Yes, I had to add that command to ensure my open dialogs did not interfere with the launching of SQL Server installation as well. Thanks for the note.

      ShieldMaster

      Comment by shieldmaster — February 7, 2017 @ 10:53 pm


RSS feed for comments on this post. TrackBack URI

Leave a reply to Daniel Brown Cancel reply

Blog at WordPress.com.