Skip to content

Instantly share code, notes, and snippets.

@andrewbbrown
Created January 24, 2018 09:58
Show Gist options
  • Save andrewbbrown/ca18b84f76c9539ce025ccaff20fe746 to your computer and use it in GitHub Desktop.
Save andrewbbrown/ca18b84f76c9539ce025ccaff20fe746 to your computer and use it in GitHub Desktop.
SQL-Server-Installer.txt
try {
# Boxstarter options
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false # Is this a machine with no logon password?
$Boxstarter.AutoLogin=$true
Update-ExecutionPolicy Unrestricted
Disable-UAC
#########################
#### requires reboot ####
#########################
Disable-InternetExplorerESC
cinst dotnet3.5
cinst dotnet4.7
cinst powershell
#######################
#### general utils ####
#######################
cinst chocolatey-core.extension
cinst 7zip.install
#######################
#### SQL Server ####
#######################
function Install-SqlServer2014 {
param (
$InstallDrive
)
if (-not(Test-Path env:\choco:sqlserver2014:isoImage) -and -not(Test-Path env:\choco:sqlserver2014:setupFolder)) {
return
}
$dataPath = Join-Path $InstallDrive "Data\Sql"
#rejected by chocolatey.org since iso image is required :|
$sqlPackageSource = "https://www.myget.org/F/nm-chocolatey-packs/api/v2"
# SQL2014 has dependency on .net 3.5
#choco install NetFx3 --source windowsfeatures --limitoutput
if (Test-PendingReboot) { Invoke-Reboot }
# Note: No support for Windows 7 https://msdn.microsoft.com/en-us/library/ms143506.aspx
$env:choco:sqlserver2014:INSTALLSQLDATADIR = $dataPath
$env:choco:sqlserver2014:INSTANCEID = "sql2014"
$env:choco:sqlserver2014:INSTANCENAME = "sql2014"
$env:choco:sqlserver2014:FEATURES = "SQLENGINE,ADV_SSMS"
$env:choco:sqlserver2014:AGTSVCACCOUNT = "NT Service\SQLAgent`$SQL2014"
$env:choco:sqlserver2014:SQLSVCACCOUNT = "NT Service\MSSQL`$SQL2014"
$env:choco:sqlserver2014:SQLCOLLATION = "SQL_Latin1_General_CP1_CI_AS"
choco install sqlserver2014 --source=$sqlPackageSource
}
function Install-SqlServer2016 {
param (
$InstallDrive
)
if (-not (Test-Path env:\choco:sqlserver2016:isoImage) -and -not(Test-Path env:\choco:sqlserver2016:setupFolder)) {
return
}
$dataPath = Join-Path $InstallDrive "Data\Sql"
#rejected by chocolatey.org since iso image is required :|
$sqlPackageSource = "https://www.myget.org/F/nm-chocolatey-packs/api/v2"
# Note: No support for Windows 7 https://msdn.microsoft.com/en-us/library/ms143506.aspx
$env:choco:sqlserver2016:INSTALLSQLDATADIR = $dataPath
$env:choco:sqlserver2016:INSTANCEID = "sql2016"
$env:choco:sqlserver2016:INSTANCENAME = "sql2016"
$env:choco:sqlserver2016:AGTSVCACCOUNT = "NT Service\SQLAgent`$SQL2016"
$env:choco:sqlserver2016:SQLSVCACCOUNT = "NT Service\MSSQL`$SQL2016"
$env:choco:sqlserver2016:SQLCOLLATION = "SQL_Latin1_General_CP1_CI_AS"
choco install sqlserver2016 --source=$sqlPackageSource
}
function Install-SqlTools {
param (
$DownloadFolder
)
choco install sql-server-management-studio --limitoutput
choco install sql-operations-studio --limitoutput
#Install-WebPackageWithCheckpoint 'SQL Source Control V3.8' 'exe' '/quiet' $DownloadFolder ftp://support.red-gate.com/patches/SQLSourceControlFrequentUpdates/23Jul2015/SQLSourceControlFrequentUpdates_3.8.21.179.exe
#Install-WebPackageWithCheckpoint 'SQL Compare V11.6' 'exe' '/quiet' $DownloadFolder http://download.red-gate.com/checkforupdates/SQLCompare/SQLCompare_11.6.11.2463.exe
}
Install-SqlServer2014 C:
Enable-UAC
Install-WindowsUpdate -AcceptEula
Write-BoxstarterMessage "Machine is complete!"
} catch {
Write-ChocolateyFailure 'Boxstarter Error: ' $($_.Exception.Message)
throw
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment