Creating Unattended SQL Server Installations with a Configuration File

By Michael Otey on March 24, 2016


Deploying SQL Server manually can be a lengthy and potentially error prone process as you work through all the different setup screens presented by the SQL Server Installation Center. If you want a standardized installation you need to be careful to enter all of the values the same every time. Plus, the installation process is interactive and it takes quite a while to complete. It’s not something where you can just press a button and walk away. Not to mention the fact that you can’t run it on Windows Server Core which can’t accommodate SQL Server Installation Manager’s graphical user interface. Fortunately, the SQL Server Installation Center provides the ability to generate a configuration file based upon the values you enter into the SQL Server Installation Center. You can then use the configuration file to deploy SQL Server in an unattended fashion with no user interaction using the same standardized configuration throughout the enterprise. In this article you’ll see how to create a SQL Server Configuration File and then use that Configuration File to perform an unattended installation of SQL Server 2014.

Creating a Standardized SQL Server Configuration Files

I created this example using the SQL Server 2014 SQL Server Installation Center but the process is essentially the same for SQL Server 2008 and higher. The SQL Server Installation Center doesn’t have a direct option to create a Configuration File. Instead, you use the SQL Server Installation Center to launch the stand-alone installation setup wizard then you step through the wizard until you reach the Ready to Install screen where you can cancel the installation and generate a Configuration File. You can see the initial SQL Server installation screen in Figure 1.

Image 1 article 2..creating unattendedFigure 1 – Launching the New SQL Server stand-alone installation or add features to an existing installation setup wizard

Select the option to install a New SQL Server stand-alone installation or to add features to an existing installation option. While this example will illustrate how to create and use a Configuration File to install a standalone instance of SQL Server you should also note that you can also use Configuration Files to install SQL Server on a Failover Cluster as well as add or remove nodes to a Failover Cluster.  After selecting the option to install a standalone SQL Server instance go ahead and follow the different dialogs presented by the setup wizard. For instance, in Figure 2 you can see where I selected the specific SQL Server features that I wanted to install.

Image 2 article 2...creating                       Figure 2 — Following the SQL Server Installation Wizard and Selecting SQL Server Features

Follow the wizard through to the Ready to Install page selecting the standard configuration options that you want to apply to the SQL Server installation. You can see the Ready to Install page shown in Figure 3.

Image 3...creating                                        Figure 3 – Ready to Install Page with the Path to the Configure File

The path to the configuration file is specified in the Ready to Install page in the Configuration file path section. To later use the Configuration File to install SQL Server cancel the setup without actually completing the installation. This will generate the file named ConfigurationFile.ini.

Installing SQL Server with a Configuration File

Once you’ve created the Configuration File you can edit a few of the parameters to create an unattended installation that doesn’t require any user input. The following listing summaries the changes to the ConfigurationFile.ini. First, comment out the UIMODE line. Then change the QUIET value to “True”. Next, change the SQLSYSADMINACCOUNTS to BUILTIN\ADMINISTRATORS. This allows it to be used more generically. However, you may want different values depending on your organization’s security requirements. Finally, add the line IACCEPTSQLSERVERLICENSETERMS=”True” to the end of the Configuration File. You can see a summary of the changes in the following listing.

; UIMODE=”Normal”
QUIET=”True”
SQLSYSADMINACCOUNTS=”BUILTIN\ADMINISTRATORS”
IACCEPTSQLSERVERLICENSETERMS=”True”

After you’ve edited the Configuration File you can use the setup.exe program to install SQL Server using the values it contains like you can see below.

d:Setup.exe /ConfigurationFile=ConfigurationFile.ini

This runs setup.exe from the d: drive and the ConfigurationFile.ini is in the current directory. You should note that you can install SQL Server using just command line parameters and the command-line values will overwrite the values in the Configuration File. For more information about how to install SQL Server with a Configuration File, you can check out Install SQL Server 2014 Using a Configuration File.

 

Related Posts

Comments

  1. Seems to generate an xml file in sql 2017, and [Begin Install] page no longer exists (goes straight into install). The xml file contains tons of options which are not supported or invalid in the context of command line. So converting it syntactically to .ini was futile.

    Was easier to just use command line (save yourself an hour, take it from me)…

    Setup.exe /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /FEATURES=”SQLENGINE, REPLICATION, SQL_INST_MR, FULLTEXT, CONN, BC, SDK” /INSTANCENAME=SQLEXPRESS /AGTSVCACCOUNT=”NT AUTHORITY\NETWORK SERVICE” /AGTSVCSTARTUPTYPE=”Disabled” /SQLSVCACCOUNT=”NT Service\MSSQL$SQLEXPRESS” /SQLSYSADMINACCOUNTS=”BUILTIN\ADMINISTRATORS” /SECURITYMODE=”SQL” /SAPWD=”mypasswordhere”

    On server core, you cannot use R services (ADVANCEDANYLTICS, SQL_INST_MR). So i removed those from features provided by a standard SQLExpress install.

    • Yes, this article is specific to 2014 SQL Server so newer releases may not use the same parameters, etc… Thanks for comment as we will look to updating this article for later releases.

  2. Hi, I want to install sql server 2017 expression edition silent install through c#. above code worked well through command prompt but when same is executed through c# application getting error

    string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + “\\SQLEXPR_x64_ENU.exe”;

    string arg= “/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /FEATURES=\”SQLENGINE, REPLICATION, SQL_INST_MR, FULLTEXT, CONN, BC, SDK\” /INSTANCENAME=SQLEXPRESS /AGTSVCACCOUNT=\”NT AUTHORITY\\NETWORK SERVICE\” /AGTSVCSTARTUPTYPE=\”Disabled\” /SQLSVCACCOUNT=\”NT Service\\MSSQL$SQLEXPRESS\” /SQLSYSADMINACCOUNTS=\”BUILTIN\\ADMINISTRATORS\” /SECURITYMODE=\”SQL\” /SAPWD=\”mypassword@123\””;

    p.StartInfo.Arguments = arg;

    p.StartInfo.CreateNoWindow = true;
    // Process the secret works.
    p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    p.Start();

    p.WaitForExit();

  3. Process p = new Process();
    p.StartInfo.FileName = path;
    string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + “\\SQLEXPR_x64_ENU.exe”;

    string arg= “/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /FEATURES=\”SQLENGINE, REPLICATION, SQL_INST_MR, FULLTEXT, CONN, BC, SDK\” /INSTANCENAME=SQLEXPRESS /AGTSVCACCOUNT=\”NT AUTHORITY\\NETWORK SERVICE\” /AGTSVCSTARTUPTYPE=\”Disabled\” /SQLSVCACCOUNT=\”NT Service\\MSSQL$SQLEXPRESS\” /SQLSYSADMINACCOUNTS=\”BUILTIN\\ADMINISTRATORS\” /SECURITYMODE=\”SQL\” /SAPWD=\”mypassword@123\””;

    p.StartInfo.Arguments = arg;

    p.StartInfo.CreateNoWindow = true;
    // Process the secret works.
    p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    p.Start();

    p.WaitForExit();

    this is my c# code

Leave a Reply