Let’s accept a few things, SQL installation is usually looooooong and quite boringJ.
And knowing the life in IT, we are always looking for an awesome quick and effective way to go about our work.
Playground for this post:-
- Windows 2008 R2 DC
- Bare Windows 2008 R2 box that has just been domain connected.
- SQL server 2008 R2 installation media and license key.
Work to be completed on the Domain Controller
- Connect the new Windows 2008 R2 box to the Domain and verify that a proper FQDN and static IP has been issued to the new server.
- Within your AD create a SQL service account (an OU already exists if your DC is on Windows 2008 R2 called Managed Service Accounts) to run all the services on your SQL server. If the scenario demands, NT AUTHORITY\NetworkService can also be used for the services.
Work to be completed prior to SQL Server Installation
I usually prefer working on scripts and installation media from a local workstation. So for this post, I have completed the following:-
- If you have an iso image of a SQL Server 2008 R2 use either 7zip, WinRAR or your favourite compression software to extract the iso file to a folder called SQL which will contain all the files within the iso.
- Make a folder within the SQL folder called SQL_Scripts.
- Once you have completely edited your scripts depending your AD account and other necessary changes to the scripts the whole SQL Folder can be copied on to the local C drive.
Now the above mentioned steps could be quite time consuming and you might wonder why not just do a standard installation? Well following an unattended installation has the following benefits:-
- Any scripting, editing of media work needs to be in most circumstances only completed once.
- Standardised method of installation.
- Good for creating a VM template that can be reused. (Remember to create the VM template with just the folder containing all the media and scripts and before installing SQL. This way you won’t have to change the name of the server every time the template is used. Meaning installation of SQL can be completed once the VM has been issued a FQDN )
- Less human error as the whole process is scripted and can be edited at any time.
SQL server installation script
This is my first edition of the script so it is always a work in progress and I shall be looking out for suggestions and improvements. At this point I would like to thank the original author’s post that I found:-
Both of them use the same method of installation using a configuration or “ini” file to setup a customized SQL installation. You could either copy the “ini” from the above post or start creating one using the parameters found on the MSDN post but I found it a bit easier to do it the following way:-
- Log onto your SQL server box as an administrator.
- Connect either the iso file to the VM or load the SQL server 2008 R2 DVD onto the server.
- Start the installation as you would from the DVD drive and go till the end of the installation just before it finally shows you the summary tab before beginning actual software installation.
At this point browse to the following folder C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20100804_145901 (the last folder may be different) which will have a file called Configuration File as shown
- Copy the file out to a local location and cancel the installation.
- Depending on all the selections that you made previously the configuration file would be completely updated with all the necessary details
Changes to the configuration file
Following screenshots will show all the necessary changes that need to be made to script
DO NOT forget to add this to the script so that the end user doesn’t have to click on accept the license agreement for complete unattended installation purposes
Now unlike other Microsoft Products I am still unable to find a location to put this configuration file along an installation media so that I could pretty much go click on setup.exe. So instead I used a command file to call setup.exe using the configuration file
Command file to run setup.exe
Basically this would need to be edited according to your environment. I usually have both the above scripts within the SQL media using a folder called SQL_Scripts and the command file edited to correct file location.
That’s it. You have a fully unattended ( erm you got to open command prompt as an administrator and run the command file ) installation of SQL server 2008 R2. Now this method will work with SQL 2008 Server famiy.
Few screenshots from the installation progress
- Wait for the script to finish and return a value “O” which shows that SQL server has been fully configured on the server.
- Restart the server.