How to Install Microsoft SQL Server 2022 Developer Edition: Using Powershell and Chocolatey
Nov 20, 2023Have you ever needed to install a relational database engine fast in your sandbox? SQL Server is well known for its easy installation, albeit not all best practices are configured as part of the general installation. In this video, I will show you how to install SQL Server 2022 Developer Edition fast using a Chocolatey and a few lines of Powershell.
Here's what you will have accomplished by the end;
- Install Chocolatey.
- Install SQL Server 2022 Developer Edition.
- Install the latest update for SQL Server 2022.
- Enable the TCP\IP protocol so that the instance is accessible within your sandbox from remote servers using SQL Server Configuration Manager.
- Install SQL Server Management Studio and Azure Data Explorer.
- Download the WideWorldImportersDW sample database backup file.
- Restore the WideWorldImportersDW database.
- Run a select query to ensure the database is accessible.
I'm installing it on a Windows Server 2022 Standard Edition evaluation copy. However, you can perform the same steps on Windows 11.
Powershell statements used in the video;
-
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
-
choco install sql-server-2022 -y
-
start-process https://download.microsoft.com/download/9/6/8/96819b0c-c8fb-4b44-91b5-c97015bbda9f/SQLServer2022-KB5031778-x64.exe
-
choco install sql-server-management-studio -y
-
start-process https://aka.ms/wwidw_mgf #download WideWorldImportersDW
-
new-item -path "c:\sql_sample_databases\" -itemType "Directory"
T-SQL used in the video to restore WideWorldImportersDW and then verify data is available by using a Select statement:
-
RESTORE DATABASE WideWorldImportersDW
FROM DISK = 'c:\sql_sample_databases\wwidw_mgf.bak'
WITH STATS = 10
-
USE WideWorldImportersDW
go
SELECT * FROM Fact.Movement
Thanks for stopping by!
Whenever you're ready, there is one way I can help you gain hands-on experience:
Automated Sandbox Fundamentals: I teach how to build a virtual lab using automation in this course. Learn how to create golden images, using both Windows and Linux, to easily spin up and add additional machines to your sandbox. It's packed with 8 modules and the scripts you'll need to build your environment. Start small, and scale as needed by easily changing the configuration file included with the course.