Deploying SQL Express

Problem: Can I silently deploy SQL Express?

Solution: Yes you can, read on…..

Here’s how I did it…

So, firstly you’ll need to download SQL Express, in this example I’m going to use SQL Express 2012 SP1.  
This is available for download from here:
http://www.microsoft.com/en-gb/download/details.aspx?id=35579.

Name Size
SqlLocalDb.msi 38.4MB
SQLEXPR_x64_ENU.exe 148.1MB
SQLEXPRADV_x64_ENU.exe 1.9GB
SQLEXPRWT_x64_ENU.exe 1.0GB
SQLManagementStudio_x64_ENU.exe 921.6MB

First thing you need to do is create a configuration file for silent install.  This can be run by opening a command prompt browsing to the folder you stored your five files and running the following command:

image

This will launch the set up for you, you must now follow it through to the last step (Ready to Install)

image

Take note of the path highlighted above.  Browse to this location and copy this configuration file.

You’ll need to edit this file because it wont be quite right for what you want.  So let’s crack it open and take a look.  First thing you’re going to have to do is add on the end the following:

; Accept the SQL Server License Terms

IACCEPTSQLSERVERLICENSETERMS="True"

This will ensure when you throw the silent install command that it wont fail on this.

If you’re like me you’ll want the Management Tools installing so you’ll need to add “,ADV_SSMS” to the end of this:

; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, MDS, and Tools. The SQL feature will install the Database Engine, Replication, Full-Text, and Data Quality Services (DQS) server. The Tools feature will install Management Tools, Books online components, SQL Server Data Tools, and other shared components. 

FEATURES=SQLENGINE,REPLICATION,SNAC_SDK

FEATURES=SQLENGINE,REPLICATION,SNAC_SDK,ADV_SSMS

Also make it truly silent by ensuring this setting is present:

; Setup will not display any user interface. 

QUIET="True"

You’ll need to comment out the UI mode setting as this will cause an error when deploying so edit as such:

; Parameter that controls the user interface behaviour. Valid values are Normal for the full UI,AutoAdvance for a simplied UI, and EnableUIOnServerCore for bypassing Server Core setup GUI block. 

; UIMODE="AutoAdvance"

(Notice the semi-colon a the beginning of the line, it (for some reason) isn’t commented out on the auto-generated configuration file.

You’ll probably require Named Pipes enabled so lets edit that section:

; Specify 0 to disable or 1 to enable the Named Pipes protocol. 

NPENABLED="1"

and finally I changed the admin account to mimic your environment:

; Windows account(s) to provision as SQL Server system administrators. 

SQLSYSADMINACCOUNTS="DOMAIN\Administrator"

Now I did read that you can approach this last section by adding “%username%” but of course that’s only going to work for you if that’s what you want.

I wrote a quick powershell script to edit the SQLSYSADMINACCOUNTS section to what I needed, this probably wont be your approach as its pretty specific to my place of work, however if you do use the –replace operator on a ForEach statement remember that the \ is a special character which will need to be escaped, therefore don’t replace “DOMAIN\Administrator” instead replace “DOMAIN\\Administrator” (note the double slash)

One final thing, I used the VB wrapper by Johan Arwidmark (Thanks Johan!) to install it.  Personally my Powershell script edits the ConfigurationFile.ini and then calls the VBwrapper.  In the VBwrapper ensure you edit…

<script language="VBScript" src="...\...\ZTIUtility.vbs"/>To point to your ZTIUtility.vbs location properly

and keep an eye on the file names in the script.   wrapper.wsf (2.7KB)

OK so how do we deploy it? well that depends on which direction you chose, first I would test either calling the VBwrapper or running your powershell script to make changes and then calling the VBwrapper (I’d be happy to try and help if anyone needs it).  Thereafter you can place the downloaded SQL files, the VBWrapper, your configuration file and your powershell script into a single folder and add them in as an application calling whichever script you need to use.

I hope this helps someone.

Jonathan.