Recently I was tasked with installing a large batch of SQL Server Instances.  I consider myself a bit of a Lazy DBA so really did not want to click-click-click my way thru the installation screens for each one of them.  I had worked places where an Unattended Install was used but had never done it myself, so I decided this is what I wanted to do.

An Unattended Install versus Clickity Click

First step, google and find out what an Unattended Install entails.  Essentially, it is running the SQL Server Install and passing an ini file with what settings we want.  This is a key value paired list to say how you want SQL Server installed.  There are quite a lot of them (https://msdn.microsoft.com/en-us/library/ms144259.aspx).  The good news is that there is an easy way to do this without having to traverse all the details.  When you run thru an SQL Server Install using the clickity click method, on the Ready to Install screen (before you click on the Install button), the path for the Configuration.ini is in the Configuration File Path box. 

I’m sure many of you are already aware of this.  However, despite doing many installations during my time, I’d never noticed it before!! 

 UnattendedInstall_1.jpg

Now one caveat…  you CAN’T just use this file as-is for your unattended installs.  If you try, the install wizard will pop up and you’ll be back to clicking.  The good news, though, is that by modifying two settings, you’ll be on your way. 

  1. The first one is QUIET. When you change it to False, the UI will not display.
  2. The second one is Update Enabled. When setting this to False, the setup program will not check for product updates.

The settings to change:

  • ; Setup will not display any user interface.

  • QUIET="False"

  • ; Specify whether SQL Server Setup should discover and include product updates. The valid values are True and False or 1 and 0. By default SQL Server Setup will include updates that are found.

  • UpdateEnabled="True"

  • Remove this setting: ; 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"

Execute

Now that we have our Configuration.ini file, we need a way to execute it.  My flavor of choice is Powershell.  The below code will take an iso, mount it, then run the install with the config file.

$SQLServerIso = "<SQL Server iso location and file name> "

$ConfigFile = "<Location and name of ini file>"

# mount the iso

   $DriveLetter = (Mount-DiskImage -ImagePath $SQLServerIso -PassThru | Get-Volume).DriveLetter + ":"

   if ($DriveLetter -eq $null) {

       throw "Could not mount SQL install iso"

   }

$cmd = "$DriveLetter\Setup.exe /ConfigurationFile=C:\UnattendedInstall\ConfigurationFile.ini"

Write-Verbose "Running SQL Install - check %programfiles%\Microsoft SQL Server\120\Setup Bootstrap\Log\ for logs..."

Invoke-Expression $cmd | Write-Verbose