Install SQL Server via Command

Install/Uninstall SQL Server via Command

This is a post on installing SQL Server via command; I have a Windows Server 2016 Core running on a local Hyper-V test environment, and I’m installing SQL Server 2019, then uninstalling it.

There’s 4 parts to this one;
# Download a SQL Server ISO.
# Mount the ISO on a Hyper-V Virtual Machine.
# Install SQL Server via Command.
# Uninstall SQL Server via Command.


Download a SQL Server ISO

As this is on my test environment, I’m installing the most recent SQL Server Edition available, which is SQL Server 2019 CTP 2.4 at the time of writing.

SQL Server 2019 can be downloaded here – Open it up and select to download the media.

SQL Server 2019 Download Media

ISO’s are good for local virtual environments (using HyperV here).

SQL Server 2019 Download Media Type

6Mbps…

SQL Server 2019 Download Speed

We’re now ready to get that ISO mounted.


Mount the ISO on a Hyper-V Virtual Machine

1. Click Media > Insert Disk…

HyperV Insert Disk

2. Select the ISO file.

SQL Server 2019 ISO File

Install SQL Server via Command

1. First, lets have a look at our drives using the Get-PSDrive cmdlet.

PowerShell Get-PSDrive

2. Install using your preferred parameters. I’m adding the Domain Admins group as Sysadmins for quickness.

SQL Server 2019 Install via Command

3. We can look at the Summary.txt file using Get-Content to verify the installation has been successful.

PowerShell Get-Content SQL Summary File
PowerShell Get-Content SQL Summary

The above shows the result of the installation was successful, and other things like where the Configuration INI file is (used for Unattended Installs).

4. Next, we should check the SQL Server services, using Get-Service with “SQL” wrapped in wildcards.

PowerShell Get-Service

Uninstall SQL Server via Command

Uninstalling is as simple as the install, funnily enough..

SQL Server 2019 Uninstall via Command

Once it’s done, we can check the summary file status and services to quickly verify the uninstallation has not been unsuccessful.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *