This script installs MS SQL Server on Windows OS silently from ISO image that can be available locally or downloaded from the Internet. Transcript of entire operation is recorded in the log file.
The script lists parameters provided to the native setup but hides sensitive data. See the provided links for SQL Server silent install details.
The installer is tested with SQL Servers 2016-2022 and PowerShell 3-7.
- Windows OS
- Administrative rights
- MS SQL Server ISO image [optional]
The fastest way to install core SQL Server is to run in administrative shell:
./Install-SqlServer.ps1 -EnableProtocols
This will download and install SQL Server Development Edition and enable all protocols. Provide your own ISO image of any edition using ISOPath
script parameter.
This assumes number of default parameters and installs by default only SQLEngine
feature. Run Get-Help ./Install-SqlServer.ps1 -Full
for parameter details.
To test installation, after running this script execute:
# Set-Alias sqlcmd "$Env:ProgramFiles\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\SQLCMD.EXE"
"SELECT @@version" | sqlcmd
- Behind the proxy use
HTTP_PROXY
environment variable - SQL Server Management Studio isn't distributed along with SQL Server any more. Install via chocolatey:
cinst sql-server-management-studio
- On PowerShell 5 progress bar significantly slows down the download. Use
$progressPreference = 'silentlyContinue'
to disable it prior to calling this function. - SQL Server Development Edition has all features of Enterprise Edition and you can license it as Enterprise edition if needed.
- Download evaluation installer from official site
- Example for v2022: https://www.microsoft.com/en-us/evalcenter/download-sql-server-2022
- This downloads file:
SQL2022-SSEI-Eval.exe
- Unpack evalutation installer exe using 7zip
- This unpacks its resources and other stuff as text files
- Search for
.iso
in files- For example using dngrep
See ticket #3 for details.
The following errors may occur:
There was an error generating the XML document
... Access denied
... The computer must be trusted for delegation and the current user account must be configured to allow delegation
The solution: Use WinRM session parameter -Authentication CredSSP
.
To be able to use it, the following settings needs to be done on both local and remote machine:
- On local machine using
gpedit.msc
, go to Computer Configuration -> Administrative Templates -> System -> Credentials Delegation.
Addwsman/*.<domain>
(set your own domain) in the following settings- Allow delegating fresh credentials with NTLM-only server authentication
- Allow delegating fresh credentials
- The remote machine must be set to behave as CredSSP server with
Enable-WSManCredSSP -Role server