Automate SQL Server Install
I couldn't find a relevant photo for this post. But you can enjoy a nice cup of coffee in the morning when you automate stuff.
As always, a great way to save time is to automate SQL Server installs. If you're in a situation where you have to install SQL Server on multiple servers in the same day and they're standardized you can take advantage of the unattended install method.
First thing is to run through the setup wizard so that you can create the configuration.ini file. This will create all the options with the settings that you desire.
The ini file will contain all the options including the drive settings for your databases, the SQLAdmin accounts, service accounts and such.
Next thing I do, is open up the .ini file and add the licensing terms switch so I don't have to interact with the install. I also comment out the UIMODE setting. UIMODE shows the user interface which is counter productive to the install.
; Required to acknowledge acceptance of the license terms.<br /> IACCEPTSQLSERVERLICENSETERMS="True"
; Parameter that controls the user interface behavior. Valid values are Normal for the full UI,AutoAdvance for a simplied UI, and EnableUIOnServerCore for bypassing Server Core setup GUI block.
;UIMODE="Normal"
You can override any of these settings when calling from the command line and the appropriate switch.
Ideally you would want this ini file to set the standard for your SQL installs (same drive configuration and such). But in certain cases, things might be different. You may also need to specify different service accounts and instance names.
For a named instance and service account specification try this:
Setup.exe /ConfigurationFile="configuration.ini" /INSTANCENAME="<instancename>" /Q
The following switches can be used to specify service account names and passwords:
/SQLSVCACCOUNT
/SQLSVCPASSWORD
/AGTSVCACCOUNT AGTSVCPASSWORD
/SAPWD
The following switches can be used to specify drive paths:
/SQLBACKUPDIR="C:\SQLTest\BACKUP"
/SQLUSERDBDIR="C:\SQLTest\DATA"
/SQLUSERDBLOGDIR="C:\SQLTest\LOG"
/SQLTEMPDBDIR="C:\SQLTest\TEMPDB"
There are so many more switches for different types of installs (including cluster installs).
For a complete list of parameters see Microsoft's documentation here.
While you can type out this command in the command prompt, you can also throw these commands into a .bat file then either execute it manually or as a scheduled job.
Here's a scenario.
Client: "I need SQL Server installed on eight servers by tomorrow!"
You: "sure" /Translation = "Create one ini file and then a .bat file for each of the servers. Schedule a job to run overnight, wake up with all eight servers ready to go!"