Note: If you are not familiar with PowerShell scripts, the script above first defines the Configuration, then executes the configuration immediately below its definition.ĭocumentation for SqlSetup may be viewed in the project's README. Import-DscResource -ModuleName SqlServerDsc Import-DscResource -ModuleName PSDesiredStateConfiguration I have named mine SQLServerConfiguration.ps1. With the NuGet package provider present, the SqlServerDsc package may now be installed.Ĭommand: Install-Module -Name SqlServerDsc -ForceĬreate a new PowerShell script. NuGet 2.8.5.208 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag.
By combining Get-PackageProvider with its ForceBootstrap parameter, the package provider will either be retrieved if it is already installed or force Package Management to automatically install it.Ĭommand Get-PackageProvider -Name NuGet -ForceBootstrap If the intent is to install SQL Server on a fresh installation of Windows Server, the NuGet package provider must be installed.
New-Item -Path C:\SQLServer -ItemType DirectoryĬopy-Item -Path (Join-Path -Path (Get-PSDrive -Name ((Mount-DiskImage -ImagePath $ImagePath -PassThru) | Get-Volume).DriveLetter).Root -ChildPath '*') -Destination C:\SQLServer\ -Recurse
The command below mounts the image and copies the contents to C:\SQLServer.Ĭommand: $ImagePath = 'C:\en_sql_server_2017_developer_圆4_dvd_11296168.iso' This may be achieved by extracting a SQL Server image to a directory. Extract Installation Mediaįor SQL Server Desired State Configuration, a source path must be provided for the installation media.
At the time of writing, commands were run in PowerShell 5.0 Steps Obtain SQL Server Installation Mediaįor demo purposes, I installed SQL Server 2017 Developer edition and moved the ISO to C:\en_sql_server_2017_developer_圆4_dvd_11296168.iso on a fresh installation of Windows Server 2016. Note: All commands specified here should be run in an administrator instance of PowerShell as elevated privileges are required. While using the GUI may be a good experience to have at least once, there is a simpler, automated method for installing SQL Server using PowerShell Desired State Configuration. If you or your organization are still using the GUI installer to setup new SQL Server installations, then you know how tedious it can be.