Chris Rasmussen · Photographer · Infrastructure Guy · Code Dabbler · Traveller

How to perform an unattended installation of SQL Server 2008 Express

A while ago I wrote an article called “How to perform an unattended installation of SQL Server 2005 Express“. With the release of SQL Server 2008 it’s time to write another one about how to do the same but for SQL Server 2008 Express. So, let’s get started …

Unattended installations of SQL Server can be as involved as you want – pretty much every option can be specified in the configuration file. For this example I’m going to perform a relatively basic installation with minimal customisation so you can see the process at work. The installation will specify most of what I think are the critical options you’ll be interested in. Note that for this example I’m using the x86 (32-bit) version with advanced services.

Assumptions:

  1. You’ve downloaded the x86 (32-bit) version of SQL Server 2008 Express from the Microsoft Microsoft SQL Server 2008 Express website
  2. Your system meets the requirements for installing SQL Server 2008
  3. You are installing from C:\Install\SQL2008 (you can change this as necessary but please make sure you update the paths in the examples below)
  4. You’ll save your configuration file as C:\Install\sql-2008-express.ini

Once you’ve satisfied those requirements follow the steps below.

  1. Run the executable you downloaded with the /x parameter (e.g. C:\Install\SQL2008\SQLEXPRADV_x86_ENU.exe
  2. Choose a location to extract the installation files to.
  3. Create a new text file that will become the unattended installation configuration file. Leave it empty for now.

Now that you’ve got a nicely extracted copy of the installation files you can carry on. The above steps were necessary for what’s coming up.

So, you can now create your own configuration file using Microsoft’s documentation or you can use the version I’ve included in this article.

Be careful with the Microsoft documentation as there is an error on the page called How to: Install SQL Server 2008 from the Command Prompt. It mentions a parameter called /BROWSERSVRACCOUNT but this should be /BROWSERSVCACCOUNT. If you get this wrong the installation WILL fail.

You can download the configuration file I’ve made below. The changes I’ve made are as follows (you may need to change these to match your settings).

  • Set the QUIETSIMPLE parameter to “True”.
  • Set the MEDIASOURCE parameter to the appropriate installation path.
  • Added a parameter called SAPWD and set it to the strong ‘sa’ password.
  • Set the INDICATEPROGRESS parameter to “True”.
  • Set the SQLSYSADMINACCOUNTS value to “MYPC\Administrator”.

Once you have your answer file all nicely setup and ready to use you’ll need to tell the setup program how to use it.

From a command prompt (or Start > Run if you’re into that) run the following command. Remember to change the file and path names to the ones that match your system.

C:\Install\SQL2008\setup.exe /CONFIGURATIONFILE=C:\Install\sql-2008-express.ini

If you’ve done everything right this will start the installation process and you’ll end up with a SQL Server 2008 instance called SQLExpress running on your system. Easy!

Click here to download a ZIP file that contains the full configuration file I’ve used in this article plus a script that does an unattended installation based on the configuration file.

20 Responses to “How to perform an unattended installation of SQL Server 2008 Express”

  1. foxjazz says:

    These instructions DO NOT WORK, I have spent 2 hours trying to figure out why this doesn’t work and no luck

    What do I do now?

    • Chris says:

      foxjazz – The steps above DO work but I have found a problem with the unattended installation file. If you were using the file I made available for download you are correct, it would not have worked. The change was setting the AGTSVCSTARTUPTYPE value to “Manual” instead of “True”. Don’t forget to also change MYPC\Administrator to the appropriate credentials for your system. Thanks.

  2. jacky says:

    hello,Chris.thank you for your instructions.now this script WORK well. but my sql server 2008 express is japanese version. the datebase date is not correctely showing . maybe the code is not right. where i should modify the script? thank you.

  3. Aritz R says:

    Thanks!I have question:
    Can you include some how initial databases during installation time, like (.mdf or .bak?)

  4. Rui says:

    Hello Chris,

    I have been trying to use your script to automate the instalation of SQL Server Express x64 SP1 but the windows installer exits before the end and doesn’t produce the desired outcome. Any ideas? Thank you

  5. Rui says:

    The installer exits without any messages. Have you tried the script with the x64 SP1 version?

    • Chris says:

      Rui: Nope, I haven’t. But I also write this article back when I was doing this stuff regularly – I haven’t used it since then as I left that site not long afterwards. I see no reason why it wouldn’t work for x64 though – it’s the same product with a different build, that’s all. Is there nothing in your event log or any of the SQL server installation logs? If there is a failure or error it should be recorded somewhere.

  6. Rui says:

    I am trying to install this on Win 7 x64 Ultimate. The installer exits after displaying a sucess message from the instalation of the support files but it does not move to the next step.

  7. Rui says:

    Yes Chris, manually I was able to instal both under Win 7 and Win Server 2008 R2 and your script failed in both systems

    I updated the script and now it works, with the same command file:

    ;SQLSERVER2008 Configuration File
    [SQLSERVER2008]

    ; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.

    INSTANCEID=”SQLExpress”

    ; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.

    ACTION=”Install”

    ; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.

    FEATURES=SQLENGINE

    ; Displays the command line parameters usage

    HELP=”False”

    ; Specifies that the detailed Setup log should be piped to the console.

    INDICATEPROGRESS=”False”

    ; Setup will not display any user interface.

    QUIET=”False”

    ; Setup will display progress only without any user interaction.

    QUIETSIMPLE=”True”

    ; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

    X86=”False”

    ; Specifies the path to the installation media folder where setup.exe is located.

    PCUSOURCE=”C:\a\sql2008EXP\PCUSOURCE”

    ; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.

    ERRORREPORTING=”False”

    ; Specify the root installation directory for native shared components.

    INSTALLSHAREDDIR=”C:\Program Files\Microsoft SQL Server”

    ; Specify the root installation directory for the WOW64 shared components.

    INSTALLSHAREDWOWDIR=”C:\Program Files (x86)\Microsoft SQL Server”

    ; Specify the installation directory.

    INSTANCEDIR=”C:\Program Files\Microsoft SQL Server”

    ; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.

    SQMREPORTING=”False”

    ; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).

    INSTANCENAME=”SQLEXPRESS”

    ; Auto-start service after installation.

    AGTSVCSTARTUPTYPE=”Manual”

    ; Startup type for Integration Services.

    ISSVCSTARTUPTYPE=”Automatic”

    ; Account for Integration Services: Domain\User or system account.

    ISSVCACCOUNT=”NT AUTHORITY\NetworkService”

    ; Controls the service startup type setting after the service has been created.

    ASSVCSTARTUPTYPE=”Automatic”

    ; The collation to be used by Analysis Services.

    ASCOLLATION=”Latin1_General_CI_AS”

    ; The location for the Analysis Services data files.

    ASDATADIR=”Data”

    ; The location for the Analysis Services log files.

    ASLOGDIR=”Log”

    ; The location for the Analysis Services backup files.

    ASBACKUPDIR=”Backup”

    ; The location for the Analysis Services temporary files.

    ASTEMPDIR=”Temp”

    ; The location for the Analysis Services configuration files.

    ASCONFIGDIR=”Config”

    ; Specifies whether or not the MSOLAP provider is allowed to run in process.

    ASPROVIDERMSOLAP=”1″

    ; Startup type for the SQL Server service.

    SQLSVCSTARTUPTYPE=”Automatic”

    ; Level to enable FILESTREAM feature at (0, 1, 2 or 3).

    FILESTREAMLEVEL=”0″

    ; Set to “1″ to enable RANU for SQL Server Express.

    ENABLERANU=”True”

    ; Specifies a Windows collation or an SQL collation to use for the Database Engine.

    SQLCOLLATION=”Latin1_General_CI_AS”

    ; Account for SQL Server service: Domain\User or system account.

    SQLSVCACCOUNT=”NT AUTHORITY\SYSTEM”

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

    SQLSYSADMINACCOUNTS=”NATARIO\Administrator”

    ; Provision current user as a Database Engine system administrator for SQL Server 2008 Express.

    ADDCURRENTUSERASSQLADMIN=”False”

    ; Specify 0 to disable or 1 to enable the TCP/IP protocol.

    TCPENABLED=”0″

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

    NPENABLED=”0″

    ; Startup type for Browser Service.

    BROWSERSVCSTARTUPTYPE=”Disabled”

    ; Specifies how the startup mode of the report server NT service. When
    ; Manual – Service startup is manual mode (default).
    ; Automatic – Service startup is automatic mode.
    ; Disabled – Service is disabled

    RSSVCSTARTUPTYPE=”Automatic”

    ; Specifies which mode report server is installed in.
    ; Default value: “FilesOnly”

    RSINSTALLMODE=”FilesOnlyMode”

    Cheers

  8. Rui says:

    Manually I was able to instal both under Win 7 and Win Server 2008 R2 and your script failed in both systems

    I updated the script and now it works, with the same command file.

  9. Rui says:

    Full script updated by comparison with a ConfigurationFile generated during a manul instalation:

    ;SQLSERVER2008 Configuration File
    [SQLSERVER2008]

    ; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.

    INSTANCEID=”SQLExpress”

    ; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.

    ACTION=”Install”

    ; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.

    FEATURES=SQLENGINE

    ; Displays the command line parameters usage

    HELP=”False”

    ; Specifies that the detailed Setup log should be piped to the console.

    INDICATEPROGRESS=”False”

    ; Setup will not display any user interface.

    QUIET=”False”

    ; Setup will display progress only without any user interaction.

    QUIETSIMPLE=”True”

    ; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

    X86=”False”

    ; Specifies the path to the installation media folder where setup.exe is located.

    PCUSOURCE=”C:\a\sql2008EXP\PCUSOURCE”

    ; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.

    ERRORREPORTING=”False”

    ; Specify the root installation directory for native shared components.

    INSTALLSHAREDDIR=”C:\Program Files\Microsoft SQL Server”

    ; Specify the root installation directory for the WOW64 shared components.

    INSTALLSHAREDWOWDIR=”C:\Program Files (x86)\Microsoft SQL Server”

    ; Specify the installation directory.

    INSTANCEDIR=”C:\Program Files\Microsoft SQL Server”

    ; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.

    SQMREPORTING=”False”

    ; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).

    INSTANCENAME=”SQLEXPRESS”

    ; Auto-start service after installation.

    AGTSVCSTARTUPTYPE=”Manual”

    ; Startup type for Integration Services.

    ISSVCSTARTUPTYPE=”Automatic”

    ; Account for Integration Services: Domain\User or system account.

    ISSVCACCOUNT=”NT AUTHORITY\NetworkService”

    ; Controls the service startup type setting after the service has been created.

    ASSVCSTARTUPTYPE=”Automatic”

    ; The collation to be used by Analysis Services.

    ASCOLLATION=”Latin1_General_CI_AS”

    ; The location for the Analysis Services data files.

    ASDATADIR=”Data”

    ; The location for the Analysis Services log files.

    ASLOGDIR=”Log”

    ; The location for the Analysis Services backup files.

    ASBACKUPDIR=”Backup”

    ; The location for the Analysis Services temporary files.

    ASTEMPDIR=”Temp”

    ; The location for the Analysis Services configuration files.

    ASCONFIGDIR=”Config”

    ; Specifies whether or not the MSOLAP provider is allowed to run in process.

    ASPROVIDERMSOLAP=”1″

    ; Startup type for the SQL Server service.

    SQLSVCSTARTUPTYPE=”Automatic”

    ; Level to enable FILESTREAM feature at (0, 1, 2 or 3).

    FILESTREAMLEVEL=”0″

    ; Set to “1″ to enable RANU for SQL Server Express.

    ENABLERANU=”True”

    ; Specifies a Windows collation or an SQL collation to use for the Database Engine.

    SQLCOLLATION=”Latin1_General_CI_AS”

    ; Account for SQL Server service: Domain\User or system account.

    SQLSVCACCOUNT=”NT AUTHORITY\SYSTEM”

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

    SQLSYSADMINACCOUNTS=”NATARIO\Administrator”

    ; Provision current user as a Database Engine system administrator for SQL Server 2008 Express.

    ADDCURRENTUSERASSQLADMIN=”False”

    ; Specify 0 to disable or 1 to enable the TCP/IP protocol.

    TCPENABLED=”0″

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

    NPENABLED=”0″

    ; Startup type for Browser Service.

    BROWSERSVCSTARTUPTYPE=”Disabled”

    ; Specifies how the startup mode of the report server NT service. When
    ; Manual – Service startup is manual mode (default).
    ; Automatic – Service startup is automatic mode.
    ; Disabled – Service is disabled

    RSSVCSTARTUPTYPE=”Automatic”

    ; Specifies which mode report server is installed in.
    ; Default value: “FilesOnly”

    RSINSTALLMODE=”FilesOnlyMode”

  10. Martin says:

    Is there a possibility to make the Installation dynamic??? That means that the Installpath is different in XP and 7. Can I use %ProgramFiles% or something to make this path dynamic???

    Greets Martin

    • Martin says:

      Ok i have the solution. You must add the dynamic-information in the command-prompt. Example:
      /INSTANCEDIR=”"%ProgramFiles%\Microsoft SQL Server”" ->in the command-prompt and delete this information from the .ini file.

  11. Ryan says:

    We’re getting stuck at the ip config part, it seems to want to use DHCP (which we do not have setup on the subnet) and the answer file doesn’t specify an ip for the SQL instance to run on.

    Does anyone know the flag or line we need to add that?

    • Chris says:

      Ryan: I’ve just a quick search and to be honest I can’t find much about how to specify the IP address during an unattended installation. Unfortunately I’m not using a system that I can test this on at the moment either – apologies!

  12. Derek says:

    Check out my blog on an unattended SQL 2008 R2 installation with scripts.

    http://derek858.blogspot.com/2010/07/unattended-sql-2008-r2-scripts.html

Leave a Reply

Powered by Wordpress | Designed by Elegant Themes