Click here to Skip to main content
15,886,362 members
Articles / Database Development / SQL Server / SQL Server 2008
Tip/Trick

Inno Setup Script to Install SQL Server 2008 R2 with Tools

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
1 Dec 2013Public Domain 34.1K   8   5
Inno Setup script to install SQL Server 2008 R2 with Tools, creating an instance with special rights and displaying the log.

Introduction

If you want to distribute your program with SQL Server, it's nice for the end user to have an installer that silently does the hard work like choosing the right options and set an instance name.

Prerequisites

You need the Inno Setup installer which can be found on SourceForge:

SQL Server 2008 R2 with Tools can be downloaded from

Background

For my purposes, I needed to install a Windows Service that could connect to SQL Server, which is not possible with a default installation of SQL Server 2008 or higher.

The following option sets the right authorization level:

/SQLSVCACCOUNT="NT AUTHORITY\SYSTEM"  

Using the Code

The example code is for 64 bits installation only.

Compile the following Inno Setup script to create the setup.exe:

;
; Inno Setup script to install SQL Server 2008 R2 with Tools.
; (see download link below for details)
; Shows the install log summary after install.
; 
; Creates instance MYINSTANCE
; Log in from SMSS with: <Computername>\MYINSTANCE
;
#define MyAppName "SQL Server 2008 R2 with Tools"
#define MyAppVersion "1"
#define MyAppPublisher "Test"
#define MyAppURL "http://www.microsoft.com/en-us/download/details.aspx?id=23650"

[Setup]
AppId={{84CDA882-8CF1-4487-85AB-DF7BA0741D2A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
OutputBaseFilename=setup
Compression=none
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "SQLEXPRWT_x64_ENU.exe"; DestDir: "{tmp}"; Flags: ignoreversion

[RUN]
Filename: "{tmp}\SQLEXPRWT_x64_ENU.exe"; 
Parameters: "/Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /FEATURES=SQL,
Tools /INSTANCENAME=MYINSTANCE /SQLSVCACCOUNT=""
NT AUTHORITY\SYSTEM"" /SQLSYSADMINACCOUNTS=""BUILTIN\ADMINISTRATORS"" 
/AGTSVCACCOUNT=""NT AUTHORITY\Network Service"" "; Check: IsWin64()
Filename: "Notepad.exe"; 
Parameters: "{pf}\Microsoft SQL Server\100\Setup Bootstrap\Log\Summary.txt";

Points of Interest

Of course, you could also use a batch file to install SQL Server this way.

Be aware that most versions of SQL Server have slightly different command line options if you are planning to use another version than SQL Server 2008 R2 !

History

  • Version 1

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Software Developer
Netherlands Netherlands
Software developer in the Netherlands, currently working on Video Surveillance applications.
Experience: C#, C++, VB, ASP, SQL Server, PostgreSQL, Gitea, TeamCity.
It all started with Black&White, no not the whiskey but the Sinclair ZX81 followed by several Atari's and PC's. The journey continues ...

Comments and Discussions

 
QuestionWhere you get the AppID Pin
jadovi19-Oct-15 6:32
jadovi19-Oct-15 6:32 
AnswerRe: Where you get the AppID Pin
RickZeeland19-Oct-15 7:27
mveRickZeeland19-Oct-15 7:27 
AnswerRe: Where you get the AppID Pin
RickZeeland19-Oct-15 7:31
mveRickZeeland19-Oct-15 7:31 
GeneralRe: Where you get the AppID Pin
jadovi20-Oct-15 10:54
jadovi20-Oct-15 10:54 
GeneralInno Setup Script to Install SQL Server 2008 R2 with Tools Pin
t.alkahtiri10-May-14 0:16
t.alkahtiri10-May-14 0:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.