SQL Server Unattended Installation with PowerShell / No More Human Errors #IaC
a PowerShell automation script for SQL Server Installation
Hi everyone! In this article, I’ll show you “how to automate SQL Server installation with PowerShell”.
Before the script, I would like to mention infrastructure as code (#IaC) approach.
As a DBA, I set up and manage lots of servers (our team responsible 1000+ database server) That means, “welcome to the complexity and human errors world” :)
Human errors are lead to lots of problems in IT systems. We can prevent human errors with automation.
Why infrastructure as code? #IaC
- No human errors
- Easy change management
- Easy to use for any employee
- No wasting time
Now, I would like to share my SQL Server installation script. I generally use PowerShell for automation tasks. I think Powershell is one of Microsoft’s best products. Simple, flexible, powerful, supports cross-platform.
This script provides installing a SQL engine service, cumulative update and management studio to a local or remote server.
You can download the script from my GitHub page.
There are some requirements:
- PowerShell 5.1 or above
- dbatools module (https://dbatools.io)
- CredSSP authentication
- Standard folder structure*
- Active Directory environment
#The folder structure should be like this:<YourSetupFolderPath>
-Cumulative update setup files
-SSMS setup files.#My folder structure for SQL Server 2019
Here is an example of usage:
The next step is SQL Server auto-configuration with PowerShell. I’ll write an article soon.
Our team also supports to dbatools development.
Thanks for reading.