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:
Once you’ve satisfied those requirements follow the steps below.
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).
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.
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!
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?
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.
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.
Thanks!I have question:
Can you include some how initial databases during installation time, like (.mdf or .bak?)
Aritz: What do you mean? Do you mean can you include existing databases during installation?
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
Rui: Do you get any error messages when the Windows Installer exits? There are logs created by the SQL server installation process – have a look at http://msdn.microsoft.com/en-us/library/ms143702.aspx for information about how to read them. Hope that helps!
The installer exits without any messages. Have you tried the script with the x64 SP1 version?
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.
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.
Rui: I assume SQL Server Express x64 w/ SP1 installs correctly on your machine when you run the installer manually?
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
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.
Rui: What did you change to make this work?
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”
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
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.
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?
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!