Aside from the standard method of installing SQL Server via the classic visual interface, there is also the option to install SQL Server from the command line or PowerShell. This is useful when you regularly perform multiple installations with similar configurations and want to dynamically define instance names, service accounts, or installation directories. Additionally, there is another option – installation via a configuration file configurationfile.ini, which contains the installation command.
Installation of SQL Server from the Command Line (cmd)
To install from the command line, you run Setup.exe and include optional parameters. A complete list of parameters, along with their descriptions, can be found on the Microsoft website – Install SQL Server from Command Prompt. Some of the most commonly used parameters include:
- /ACTION – with values INSTALL, UNINSTALL
- /QS – Quiet Simple mode – shows installation progress. Additionally, /Q can be used for quiet mode
- /IACCEPTSQLSERVERLICENSETERMS – a mandatory parameter where you declare your agreement with the licensing terms
- /CONFIGURATIONFILE – if you want to perform the installation from a configuration file, specify the path
- /FEATURES – which features you want to install (comma-separated without spaces)
- SQL – installs SQL Server Database Engine, Replication, FULL-Text, Data Quality Server
- IS – Integration Services
- AS – Analysis services
- RS – Reporting Services
- DQC – Data quality client
- /INSTANCENAME – How the SQL instance should be named
- /PID – Product Key. If not provided, the SQL Server evaluation edition will be installed
- /SQLSVCACCOUNT – SQL Server service account name
- /SQLSVCPASSWORD – Password for the SQL Server service account
Example syntax for installation: Run the command prompt as an administrator
SQLServer2017-SSEI-Dev.exe /QS /ACTION=Install /FEATURES=SQL,IS,RS /INSTANCENAME=MyInstance /IACCEPTSQLSERVERLICENSETERMS