I have a need to perform a silent, command-line install of SQL Server 2008 Express as a pre-requisite for a server application. While there’s an extensive listing of all the many options available for a command-line install of SQL Server, it still took me a while to sift through what was really needed for a basic, minimal install.
I should add that I’m using InstallShield and setting SQL Server as one of the pre-req’s, but it still requires the command-line switches:
What you’re seeing up there is the right way to do it. Before, I only had the “/q” switch, telling SQL Server to run silently. I thought that was enough. Oh, was I wrong. I ran the install, SQL Server looked like it was doing something, but I kept getting an error dialog from InstallShield saying the SQL Server part of the install did not complete successfully. So, the first thing I did was take a step back and attempt to get just the SQL Server install to run, sans InstallShield, from a plain old command prompt.
The first step was to, of course, get SQL Server Express (I was letting InstallShield download from the web, and who knows what happened to that copy). You’ve got several choices; I only wanted the basic database, so I chose the “Database Only” option.
Note that if you’re using a plain vanilla VPC like me with a new Windows OS install, you’ll likely also need to install Windows Installer 4.5, which is required by SQL Server.
As you’re trying to get your command-line setup correctly, one of the best places I found to determine what went wrong when an install didn’t work was to look at the log file in the folder “C:Program FilesMicrosoft SQL Server100Setup BootstrapLog”. Open one of the sub-folders (which are named with the install time) and open the “Summary” text file.
With Windows Installer and SQL Server Express 2008 installed, here’s the command-line I wound up using:
1: SQLEXPR32_x86_ENU.exe /q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS
2: /INSTANCENAME=SQLSERVER /ROLE=AllFeatures_WithDefaults
3: /ADDCURRENTUSERASSQLADMIN=TRUE /SQLSVCACCOUNT="NT AUTHORITYNetwork Service"
Oddly enough, you can’t just take those switches and throw them into InstallShield. You’ll get a couple of errors during the SQL Server install if you do (take a look at the SQL log files at “C:Program FilesMicrosoft SQL Server100Setup BootstrapLog” if you do). So, here are the switches I had to use to keep InstallShield happy:
1: /q /ACTION=Install /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic
2: /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITYNetwork Service"
3: /SQLSYSADMINACCOUNTS="BUILTINADMINISTRATORS" /AGTSVCACCOUNT="NT AUTHORITYNetwor