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-2019 and PowerShell 3-7.
- Windows OS
- MS SQL Server ISO image
- Administrative rights
The fastest way to install core SQL Server is to run in administrative shell without any parameters:
./Install-SqlServer.ps1
Use ISOPath
parameter otherwise.
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.
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