SQL Server – Unattended Installation with Configuration.ini Override

installationpowershellsql-server-2012

I am creating a PowerShell script to install SQL Server 2012 silent installation. It is not hard to find a tutorial or instructions online on how to do so. I want to my script be a bit more flexible by keeping the defaults in Configuration.INI file and override the configurations in script arguments.

Does the parameter provided to C:\SQL2012\setup.exe override the configurations in Configuration.INI? For example:

The configuration file has default INSTANCEDIR="C:\Program Files\Microsoft SQL Server", if I provide alternative to setup.exe, does that override it:

C:\SQL2012\setup /INSTANCEDIR="D:\SQL Server\" /ConfigurationFile="C:\SQL2012\ConfigurationFile.ini"

Also, if I have not specified a parameter in configuration file, but I want specify now, such as Data File locations, is the installation OK with that?

# /INSTALLSQLDATADIR is not specified in Configuration.INI file
C:\SQL2012\setup /INSTALLSQLDATADIR="D:\SQL Server\data" /ConfigurationFile="C:\SQL2012\ConfigurationFile.ini"

Best Answer

If you provide a parameter at the command line it will override that parameter in the configuration file. Additionally, any parameters not included in the configuration file can be added to the command line instead.

More info here.