Unattended installation of SQL Server

Unattended installation of SQL Server

It is a third post on series related to installation and configuration of SQL Server installations.

This series is for professionals who start their journey with SQL Server administration and also for those who want to extend and structure their knowledge on SQL Server administration.

Preparations

We are starting with the following assumptions:

  1. All steps described in this first blog post has been configured
  2. ISO file with SQL Server binaries and Cumulative Update files are available – steps how to download it are described in previous blog post 
  3. There is a connection between Windows server and domain controller
  4. No issues with connectivity with Active Directory domain (no AD-related errors in System Event Log)

Use case

Imagine a situation when you are tasked to install a dozen SQL Server instances. Using an approach described in previous blog post  installation can take a significant amount of resources and time, also there is a probability of errors due to typos (e.g. in directory paths, etc.)
There are two options that can be used for the installation:

  1. Using ConfigurationFile.ini
  2. Using command line parameters to setup.exe file

Below there are step-by-step instructions on how to install SQL Server using both options.

Installation of SQL Server using ConfigurationFile.ini

In the previous post on one of the last configuration screen (Ready to Install), I have marked the path to ConfigurationFile.ini generated automatically by the installer. This file contains all of the settings that you have selected during installation using GUI.
Let’s go to C:Program FilesMicrosoft SQL Server140Setup BootstrapLog<date_time> location

Let’s have a look at the ConfigurationFile.ini file:

Inside file we have several sections that are interesting for us:

  1. QUIET – determines if a user interface is disabled
  2. QUIETSIMPLE – Setup will display  progress only, without any user interaction
  3. UIMODE – defines how User Interface will be displayed, requires that QUIETSIMPLE is set to True
  4. UpdateEnabled – allows installation of updates
  5. UpdateSource – specifies the location of updates
  6. INDICATEPROGRESS – specifies that the detailed log will be shown on the console

Having all these parameters we can start installing SQL Server using different modes

Manual installation with populated configuration settings

In this sections following parameters will be used:

  1. QUIET=”False”
  2. QUIETSIMPLE=”False”
  3. UIMODE=”Normal”
  4. UpdateEnabled=”False”
  5. UpdateSource=”MU”
  6. INDICATEPROGRESS=”False”

To start installation run command line and provide the following command:

E:setup.exe /ConfigurationFile=D:DBAConfigurationFile.ini

where E: is the path to SQL Server binaries.

After running above command, GUI installation with start with values already provided

All of the configuration values are taken from ConfigruationFile.ini.

Manual installation with populated configuration settings using latest Cumulative Update located in D:DBAUpdates directory

In this sections following parameters will be used:

  1. QUIET=”False”
  2. QUIETSIMPLE=”False”
  3. UIMODE=”Normal”
  4. UpdateEnabled=”True”
  5. UpdateSource=”D:DBAUpdates”
  6. INDICATEPROGRESS=”False”

To start installation run command line and provide the following command:

E:setup.exe /ConfigurationFile=D:DBAConfigurationFile.ini

where E: is the path to SQL Server binaries

After running above command, GUI installation with start with values already provided.

All of the configuration values are taken from ConfigruationFile.ini.

Automated installation using latest Cumulative Update from D:DBAUpdates directory with progress indication

In this sections following parameters will be used:

  1. QUIET=”False”
  2. QUIETSIMPLE=”True”
  3. ;UIMODE=”Normal” <- commented out
  4. UpdateEnabled=”True”
  5. UpdateSource=”D:DBAUpdates”
  6. INDICATEPROGRESS=”False”

To start installation run command line and provide the following command:

E:setup.exe /ConfigurationFile=D:DBAConfigurationFile.ini /IAcceptSQLServerLicenseTerms

where E: is the path to SQL Server binaries

After running above command, the installation will start using values from the configuration file.

After setting up all installation file, installation of SQL Server itself will start.

After completing this step SQL Server is ready for use.

Fully automated installation using latest Cumulative Update from D:DBAUpdates directory

In this sections following parameters will be used:

  1. QUIET=”True”
  2. QUIETSIMPLE=”False”
  3. ;UIMODE=”Normal” <- commented out
  4. UpdateEnabled=”True”
  5. UpdateSource=”D:DBAUpdates”
  6. INDICATEPROGRESS=”True”

To start installation run command line and provide the following command:

E:setup.exe /ConfigurationFile=D:DBAConfigurationFile.ini /IAcceptSQLServerLicenseTerms

Where E: is the path to SQL Server binaries

There will be no GUI window displayed, the only information is shown on the console. Once all steps complete SQL Server is ready for use.

Installation of SQL Server using a command line

An alternative option is to use command line parameters to install SQL Server. In the following example, I am going to install SQL Server with indication of installation.

For the installation following parameters are provided:

  • QS
  • ACTION=Install
  • FEATURES=SQLENGINE
  • ENU
  • UpdateEnabled=1
  • UpdateSource=”D:DBAUpdates”
  • INSTANCEDIR=”D:MSSQLServer”
  • INSTANCENAME=MSSQLSERVER
  • SQLSVCACCOUNT=”DATACOMMUNITYSQLServerEngine$”
  • SQLSYSADMINACCOUNTS=”DATACOMMUNITYadministrator”
  • AGTSVCACCOUNT=”DATACOMMUNITYSQLServerAgent$”
  • AGTSVCSTARTUPTYPE=”Automatic”
  • BROWSERSVCSTARTUPTYPE=”Disabled”
  • INSTALLSQLDATADIR=”D:MSSQLServer”
  • SQLBACKUPDIR=”D:SQLBackup”
  • SQLCOLLATION=”SQL_Latin1_General_CP1_CI_AS”
  • SQLSVCSTARTUPTYPE=”Automatic”
  • SQLTEMPDBDIR=”D:SQLTempDB01″ “D:SQLTempDB02” “D:SQLTempDB03” “D:SQLTempDB04”
  • SQLTEMPDBLOGDIR=”D:SQLTLog”
  • SQLUSERDBDIR=”D:SQLData00″
  • SQLUSERDBLOGDIR=”D:SQLTLog”
  • SQLTEMPDBFILECOUNT=4
  • IACCEPTSQLSERVERLICENSETERMS

Having all parameters together, command will look like as follows:

E:setup.exe /QS /ACTION=Install /FEATURES=SQLENGINE /ENU /UpdateEnabled=1 /UpdateSource="D:DBAUpdates" /INSTANCEDIR="D:MSSQLServer" /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="DATACOMMUNITYSQLServerEngine$" /SQLSYSADMINACCOUNTS="DATACOMMUNITYadministrator" /AGTSVCACCOUNT="DATACOMMUNITYSQLServerAgent$" /AGTSVCSTARTUPTYPE="Automatic" /BROWSERSVCSTARTUPTYPE="Disabled" /INSTALLSQLDATADIR="D:MSSQLServer" /SQLBACKUPDIR="D:SQLBackup" /SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" /SQLSVCSTARTUPTYPE="Automatic" /SQLTEMPDBDIR="D:SQLTempDB01" "D:SQLTempDB02" "D:SQLTempDB03" "D:SQLTempDB04" /SQLTEMPDBLOGDIR="D:SQLTLog" /SQLUSERDBDIR="D:SQLData00" /SQLUSERDBLOGDIR="D:SQLTLog" /SQLTEMPDBFILECOUNT=4 /IACCEPTSQLSERVERLICENSETERMS

After running above command, installation will start

After installation, the progress window will be closed and SQL Server is ready for install.

This option my preferred way to install SQL Server. If you are interested in PowerShell script for unattended SQL Server installation based on provided parameters, visit my GitHub repository.

Summary

In complex environments installation of SQL Server instances can be a tedious task that can be easily automated. This blog post extensively describes methods of possible installation.
Also, smaller environments can benefit from this approach by minimizing the time needed for installation, keeping quality on the same level. Every time when you want to use unattended installation SQL Server, check this blog post for all steps.

Links

More information about steps described above can be found on the following sites:
Install SQL Server using a configuration file
Install SQL Server from the Command Prompt
https://github.com/michalsadowski/SQLBuild

Previous The most-read posts in 2018
Next Last Week Reading (2019-01-06)

About author

Michal Sadowski
Michal Sadowski 13 posts

Senior Database Platform Engineer, leader of Krakow chapter of Data Community Krakow - PASS Chapter. With more than 10 years of experience in Microsoft technology, helps in advisory for performance optimization on database and application levels. Holds many Microsoft certificates including MCSA: Windows Server 2008/2012/2016, MCSA: SQL Server 2012/2014/2016, MCSE: Data Platform and MCT.

View all posts by this author →

You might also like

Starting as DBA from zero 2 Comments

Installation of SQL Server using GUI

It is a second post on series related to installation and configuration of SQL Server installations. This series is for professionals who starts their journey with SQL Server administration and

Starting as DBA from zero 0 Comments

What is containerization?

It is the first post on series related to installation and configuration of containers on the Microsoft Windows platform. This series is for professionals who start their journey with the

Starting as DBA from zero 0 Comments

Installation of Docker Desktop for Windows

It is the first post on series related to installation and configuration of Docker containers on the Microsoft Windows platform. This series is for professionals who start their journey with

6 Comments

  1. Nik
    February 28, 20:51 Reply

    Hi, This simply does not work. It always failed with the error:
    The Windows account “MyDomain\My Account” does not exist and cannot be provisioned as a SQL Server system administrator. The machine is not joined to the domain. Any idea how to bypass these with SQL Server Developers install command line and using Configuration.ini?

    • Michal Sadowski
      February 28, 21:05 Reply

      Hi Nik,
      If you are installing SQL Server on the computer not joined to the domain, provide “administrators” or another local group as a parameter to SQLSYSADMINACCOUNTS option.
      Best regards,
      Michał

  2. tempo
    March 02, 13:06 Reply

    This excellent website certainly has all the info I wanted concerning this subject and didn’t know who to ask.

  3. Bernhard
    April 15, 10:05 Reply

    Hello Michael,
    your article helped me a lot. I had to move 20 Instances on a single server with a very small time slot.
    Thank you!

    • Michal Sadowski
      April 15, 13:25 Reply

      Hello Bernhard,
      Thank you for the kind words!
      Best regards,
      Michal

  4. dimbulbz
    November 01, 22:09 Reply

    Is it possible to upgrade SQL (say from 2012 to 2022) server using a batch process? We have many instances that need to be upgraded and a small window to accomplish it.

Leave a Reply