function Install-AlkamiDeveloperSQLServer { <# .SYNOPSIS This script is used to help consistently install SQL server for developers against the Alkami Platform .PARAMETER SetupExePath The path to the setup.exe program for SQL Server. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] $SetupExePath ) if ((Split-Path $SetupExePath -Leaf -ErrorAction Continue) -ne "setup.exe") { $SetupExePath = (Join-Path $SetupExePath "setup.exe") } if (!(Test-Path $SetupExePath -ErrorAction Continue)) { throw 'Can not find the setup.exe path' } $user = "$env:UserDomain\$env:USERNAME" Write-Host "Setting [$user] as local sql sa admin" $securePassword = [System.Web.Security.Membership]::GeneratePassword(24,5).Replace('"',"'") $configFileContents = @" [OPTIONS] IACCEPTSQLSERVERLICENSETERMS="True" IACCEPTPYTHONLICENSETERMS="True" ACTION="Install" IACCEPTROPENLICENSETERMS="True" SUPPRESSPRIVACYSTATEMENTNOTICE="True" ENU="True" QUIET="True" QUIETSIMPLE="False" UpdateEnabled="False" USEMICROSOFTUPDATE="False" SUPPRESSPAIDEDITIONNOTICE="True" UpdateSource="MU" FEATURES=SQLENGINE,CONN,SDK HELP="False" INDICATEPROGRESS="True" X86="False" INSTANCENAME="MSSQLSERVER" INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server" INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server" INSTANCEID="MSSQLSERVER" SQLTELSVCACCT="NT Service\SQLTELEMETRY" SQLTELSVCSTARTUPTYPE="Automatic" INSTANCEDIR="C:\Program Files\Microsoft SQL Server" AGTSVCACCOUNT="NT Service\SQLSERVERAGENT" AGTSVCSTARTUPTYPE="Manual" COMMFABRICPORT="0" COMMFABRICNETWORKLEVEL="0" COMMFABRICENCRYPTION="0" MATRIXCMBRICKCOMMPORT="0" SQLSVCSTARTUPTYPE="Automatic" FILESTREAMLEVEL="0" SQLMAXDOP="8" ENABLERANU="False" SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" SQLSVCACCOUNT="NT Service\MSSQLSERVER" SQLSVCINSTANTFILEINIT="False" SQLSYSADMINACCOUNTS="$user" SECURITYMODE="SQL" SQLTEMPDBFILECOUNT="8" SQLTEMPDBFILESIZE="8" SQLTEMPDBFILEGROWTH="64" SQLTEMPDBLOGFILESIZE="8" SQLTEMPDBLOGFILEGROWTH="64" ADDCURRENTUSERASSQLADMIN="False" TCPENABLED="1" NPENABLED="1" BROWSERSVCSTARTUPTYPE="Automatic" SQLMAXMEMORY="2147483647" SQLMINMEMORY="0" SAPWD="$securePassword" "@ $installTempConfigPath = (New-TemporaryFile) Set-Content -Path $installTempConfigPath -Value $configFileContents $errorOutputFile = (Join-Path (Split-Path $installTempConfigPath -Parent) "errorOutput.txt") $standardOutputFile = (Join-Path (Split-Path $installTempConfigPath -Parent) "standardOutput.txt") Write-Host "Starting the install of SQL Server" Start-Process $SetupExePath "/ConfigurationFile=$installTempConfigPath" -Wait -RedirectStandardOutput $standardOutputFile -RedirectStandardError $errorOutputFile $newTempFile = (New-TemporaryFile); Set-Content -value "Please record this secure password somewhere for future reference.`r`nThis password will not be available when you close this window.`r`nThis is the SQL Server root sa password and is very important.`r`n`r`n SA PASSWORD: $securePassword`r`n`r`nPlease maintain this password in a secure location." -Path $newTempFile; notepad.exe $newTempFile; Start-Sleep -Seconds 10; Remove-Item $newTempFile; Remove-Item $installTempConfigPath -Force $standardOutput = Get-Content $standardOutputFile -Delimiter "\r\n" Write-Host $standardOutput $errorOutput = Get-Content $errorOutputFile -Delimiter "\r\n" Write-Host $errorOutput Write-Host "If no red text then SQL Server Successfully Installed!" }