Skip to content

majkinetor/Install-SqlServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install-SqlServer

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.

Prerequisites

  1. Windows OS
  2. Administrative rights
  3. MS SQL Server ISO image [optional]

Usage

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

Notes

  • 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.

How to find SQL Server direct download

  1. Download evaluation installer from official site
  2. Unpack evalutation installer exe using 7zip
    • This unpacks its resources and other stuff as text files
  3. Search for .iso in files

See ticket #3 for details.

Direct download list

  1. 2022 Development Edition
  2. 2019 Development Edition

Troubleshooting

Installing on remote machine using PowerShell remote session

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:

  1. On local machine using gpedit.msc, go to Computer Configuration -> Administrative Templates -> System -> Credentials Delegation.
    Add wsman/*.<domain> (set your own domain) in the following settings
    1. Allow delegating fresh credentials with NTLM-only server authentication
    2. Allow delegating fresh credentials
  2. The remote machine must be set to behave as CredSSP server with Enable-WSManCredSSP -Role server

Links

Releases

No releases published

Packages

No packages published