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.
ISO’s are good for local virtual environments (using HyperV here).
We’re now ready to get that ISO mounted.
Mount the ISO on a Hyper-V Virtual Machine
1. Click Media > Insert Disk…
2. Select the ISO file.
Install SQL Server via Command
1. First, lets have a look at our drives using the Get-PSDrive cmdlet.
2. Install using your preferred parameters. I’m adding the Domain Admins group as Sysadmins for quickness.
3. We can look at the Summary.txt file using Get-Content to verify the installation has been successful.
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.
Uninstall SQL Server via Command
Uninstalling is as simple as the install, funnily enough..
Once it’s done, we can check the summary file status and services to quickly verify the uninstallation has not been unsuccessful.