Blog Post

“Done in 7 minutes” -SQL Server 2019 Install

,

This blog comes to you from the home office after three days of caring for my sick six-year-old son. Yay for stomach bugs…

Have you ever needed to install SQL Server for a quick test of a feature, stand up a fresh instance for a team, or automation?

Like anything with technology, there are multiple ways to accomplish something. Sure, you could track down the DVD, stick it in the server and go through the Setup.  Oh, maybe if the year was 2015. These days you have the ISO stored on a network share, mount it to the VM, and run Setup.

I choose to build PowerShell scripts to accomplish this type of request. Recently I decided to perform some time metrics to see how quickly I could get an instance ready for a user.

My demo will walk through using dbatools.io and PowerShell to perform two different types of installations of SQL Server 2019.

Using the

Install-DbaInstance function, I performed an installation using splatting and a configuration.ini file.

Demo One – Splatting

-- Splatting
$servers = "SERVER1"
$config = @{
    UPDATEENABLED = "True"
    UPDATESOURCE = "\networkshareSoftwareMicrosoftSQLSQL Server 2019 Updates"
}

Get-Date
$installparams = @{
    SqlInstance     = $servers
    Version         = 2019
    Verbose         = $true
    Confirm         = $false
    Credential      = $cred
    Feature         = "Engine"
    InstancePath    = "C:SQL"
    DataPath        = "C:SQLData"
    LogPath         = "C:SQLLOG"
    TempPath        = "C:SQLDATA"
    BackupPath      = "C:SQLBACKUP"
    Path            = "\networkshareSoftwareMicrosoftSQLSQL Server 2019 Developer"
    Configuration   = $config
}
Install-DbaInstance @installparams
Get-Date

Above, you can see the script executed utilizing the PowerShell Splatting format.

  1. Set the server name that you want to install SQL Server on.
  2. To optimize the installation, it is best to slipstream the patches after the installation, so second, you will point the installation process to the location of your patches.
  3. Finally, the parameters can be assigned for each needed installation value.

Notice how I started and ended the script with the

Get-Date command to keep track of the time it takes from start to finish.

For this installation, the timing results are as follows:

Install Start – 1:50:19 PM

Install Complete – 1:57:47 PM

Total Time – 7 minutes


Demo Two – Configuration.ini File

-- Via config file
Get-Date
Install-DbaInstance -SqlInstance SERVER2`
    -ConfigurationFile "E:DBAConfigurationFile.ini" `
    -Path "\networkshareSoftwareMicrosoftSQLSQL Server 2019 Developer" `
    -Version 2019 -Credential $cred -Verbose -Confirm:$false
Get-Date

This demonstration is for you if you have a pre-configured configuration.ini file that you simply change settings in.

Let us see how this type of installation differs when comparing the installation times.

Install Start – 1:38:49 PM

Install Complete – 1:47:01PM

Total Time – 9 minutes


Conclusion

We achieved automated installs with both types of SQL Server installation options, fully patched in less than 10 minutes.

The post “Done in 7 minutes” -SQL Server 2019 Install appeared first on GarryBargsley.com.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating