This post is to Automate SQL Server installations using unattended installation concept through command prompt.
To automate installation requires SQL Server ConfigurationFile, SQL Setup generates a configuration file based upon the dba inputs and files named ConfigurationFile.ini. The ConfigurationFile.ini file is a text file which contains the set of parameters in name/value pairs along with descriptive comments. Many of the parameter names correspond to the screens and options which you see while installing SQL Server through the wizard.
You can then use the configuration file to install SQL Server with the same configuration instead of going through each of the installation screens.
To create ConfigurationFile, follow the below steps:
1. Run SQL Server 2012 Setup as you normally would.
2. Set all of the configuration settings you want, clicking through all of the pages of the setup wizard.
3. When you reach the “Ready to Install” page, Setup will allow you to review all of your configuration settings. In addition, at the bottom of the screen it will show you the path of the configuration file that it has created itself. Make note of the configuration file path so you can grab the configuration file.
4. Cancel Setup.
Now, edit the ConfigurationFile as follows:
1. Set QUIET to “True”. This specifies that Setup will run in a quiet mode without any user interface
QUIET="True"
2. Set SQLSYSADMINACCOUNTS to “BUILTINADMINISTRATORS”. This will ensure that administrators on the machine are added as members of the sysadmin role. You can set its value based on your needs (Ex: SQLSYSADMINACCOUNTS=”domainYourUser”), but this is the more generic approach. I have added My user instead of BUILTINADMINISTRATORS, to secure SQL server from unwanted logins.
SQLSYSADMINACCOUNTS="BUILTINADMINISTRATORS"
3. Add PID and set its value to your product license key. If your setup.exe already comes preloaded with the key, there is no need to add this option to the configuration file.
4. Add IACCEPTSQLSERVERLICENSETERMS and set its value to “True”. This is to require to acknowledge acceptance of the license terms at time of unattended installations.
IACCEPTSQLSERVERLICENSETERMS="True"
5. Remove the UIMODE parameter as it can’t be used with the QUITE parameter.
6. Add the Directory of INSTALLSHAREDDIR, INSTALLSHAREDWOWDIR, INSTANCEDIR parameters. but if you want to install on the default installation directories then you can remove these parameters.
7. You can add or remove the feature you want to install, Select FEATURES=SQLENGINE,SSMS,ADV_SSMS in the configuration file. You can change that based on your needs.
For more details on features refer Article
Now ConfigurationFile.ini is ready, to execute that will create "SQLInstaller.bat" file which ask for the password and calls the ".ini".
Copy the below script and save as "SQLInstaller.bat"
That's it!!
Run the ".bat" as administrator, Enter the password and wait for sometimes. Installation will get complete after that verify the SQL Services & Instance.
To automate installation requires SQL Server ConfigurationFile, SQL Setup generates a configuration file based upon the dba inputs and files named ConfigurationFile.ini. The ConfigurationFile.ini file is a text file which contains the set of parameters in name/value pairs along with descriptive comments. Many of the parameter names correspond to the screens and options which you see while installing SQL Server through the wizard.
You can then use the configuration file to install SQL Server with the same configuration instead of going through each of the installation screens.
To create ConfigurationFile, follow the below steps:
1. Run SQL Server 2012 Setup as you normally would.
2. Set all of the configuration settings you want, clicking through all of the pages of the setup wizard.
3. When you reach the “Ready to Install” page, Setup will allow you to review all of your configuration settings. In addition, at the bottom of the screen it will show you the path of the configuration file that it has created itself. Make note of the configuration file path so you can grab the configuration file.
4. Cancel Setup.
Now, edit the ConfigurationFile as follows:
1. Set QUIET to “True”. This specifies that Setup will run in a quiet mode without any user interface
QUIET="True"
2. Set SQLSYSADMINACCOUNTS to “BUILTINADMINISTRATORS”. This will ensure that administrators on the machine are added as members of the sysadmin role. You can set its value based on your needs (Ex: SQLSYSADMINACCOUNTS=”domainYourUser”), but this is the more generic approach. I have added My user instead of BUILTINADMINISTRATORS, to secure SQL server from unwanted logins.
SQLSYSADMINACCOUNTS="BUILTINADMINISTRATORS"
3. Add PID and set its value to your product license key. If your setup.exe already comes preloaded with the key, there is no need to add this option to the configuration file.
4. Add IACCEPTSQLSERVERLICENSETERMS and set its value to “True”. This is to require to acknowledge acceptance of the license terms at time of unattended installations.
IACCEPTSQLSERVERLICENSETERMS="True"
5. Remove the UIMODE parameter as it can’t be used with the QUITE parameter.
6. Add the Directory of INSTALLSHAREDDIR, INSTALLSHAREDWOWDIR, INSTANCEDIR parameters. but if you want to install on the default installation directories then you can remove these parameters.
7. You can add or remove the feature you want to install, Select FEATURES=SQLENGINE,SSMS,ADV_SSMS in the configuration file. You can change that based on your needs.
For more details on features refer Article
Now ConfigurationFile.ini is ready, to execute that will create "SQLInstaller.bat" file which ask for the password and calls the ".ini".
Copy the below script and save as "SQLInstaller.bat"
@echo off echo Installing SQL Server 2012 echo. set /p SSvcpwd= Enter SQL Service Account Password "ENTERPRISE\SQLServices": echo. pause date/t time /t "D:\SQLEntEdtn_2012_English\setup.exe" /SQLSVCPASSWORD="%SSvcpwd%"/AGTSVCPASSWORD="%SSvcpwd%" /ISSVCPASSWORD="%SSvcpwd%" /RSSVCPASSWORD="%SSvcpwd%" /ConfigurationFile="C:\SQLInstaller\ConfigurationFile.ini" date/t time /t pause
That's it!!
Run the ".bat" as administrator, Enter the password and wait for sometimes. Installation will get complete after that verify the SQL Services & Instance.