Thursday, 14 October 2010

Silent, unattended installation of SQL Server 2008

This is something that’s not nearly as hard as it sounds. Silent, unattended installs for any Microsoft product hang on the .ini file, the usual problem is creating these. In the SQL Server 2008 world there is a neat trick to generating your .ini file. If you run through the install wizard, on the “Ready to Install” dialog near the end you will be shown a “Configuration file path” value at the bottom of the dialog box. This is the path to the .ini file representing the configuration you just selected (which components, accounts etc.).

image

In the above summary, I’ve selected most of the features aside from SQL Server Integration Services, Report Server (I just want the Database Engine for BizTalk Server 2009). I’ve also selected a named instance and a custom installation directory for the instance (because I want to run side-by-side with SQL Server 2008 R2).

Note the “Configuration file path” value and quit the installer.

Take a copy of the .ini file from the path shown and put it in a simple path. You need to make the following changes:

  • Change the “QUIET” value from “False” to “True” (to suppress dialogs)
  • Change the “INDICATEPROGRESS” value from “False” to “True” (to show output in the console)

Run the installer using the following command line:

  • C:\>[Path to SQL Server media]\setup.exe /CONFIGURATIONFILE="[some path]\ConfigurationFile.ini"

The console should present you with something like the following:

One or more affected files have operations pending.
You should restart your computer to complete this process.

Things to be aware of:

  • The accounts you chose for the Administrator roles are stored in the .ini file, so choose Domain Accounts/Groups or well known accounts/groups (like BUILTIN\Administrators). If you choose machine specific accounts you will have problems installing to other servers.
  • The path to the SQL Server 2008 installation media is also stored in the .ini file so store it in a common location like a network share (and run the install wizard from this location when generating the .ini file).

You can use this strategy to ensure consistency of SQL Server installations across a team of developers or for quicker building of virtual machines.

Note this technique also works with MS SQL Server 2008 R2 but you must do two things differently:

  • Comment out the “UIMODE” entry in the .ini file (put a “;” at the start of the line).
  • Add the “/IAcceptSQLServerLicenseTerms” switch when calling setup.exe (no need for a value with the switch).

About Me