diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 8ba4594e7..03c4b98f8 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -166,9 +166,9 @@ function Start-DownloadWithRetry param ( [Parameter(Mandatory)] [string] $Url, - [string] $DownloadPath = "${env:Temp}", [Parameter(Mandatory)] [string] $Name, + [string] $DownloadPath = "${env:Temp}", [int] $retries = 20 ) $FilePath = Join-Path $DownloadPath $Name diff --git a/images/win/scripts/Installers/Install-SQLExpress.ps1 b/images/win/scripts/Installers/Install-SQLExpress.ps1 index 27d19147c..a56f09cca 100644 --- a/images/win/scripts/Installers/Install-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Install-SQLExpress.ps1 @@ -6,6 +6,7 @@ Import-Module -Name ImageHelpers -Force; function Download-FullSQLPackage { param( + [Parameter(Mandatory)] [String]$InstallerPath, [String]$DownloadPath, [String]$Arguments = ("/MEDIAPATH=$DownloadPath", "/MEDIATYPE=Core","/Action=Download", "/QUIET") @@ -26,6 +27,7 @@ function Download-FullSQLPackage { function Unpack-SQLInstaller { param( + [Parameter(Mandatory)] [String]$InstallPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS") ) @@ -46,6 +48,7 @@ function Unpack-SQLInstaller { function Start-Installer { param( + [Parameter(Mandatory)] [String]$InstallerPath, [String]$Arguments = ("/Q", "/IACCEPTSQLSERVERLICENSETERMS", "/Action=Install", "/INSTANCEID=SQL2019", "/INSTANCENAME=SQL2019", "/SECURITYMODE=SQL", "/SAPWD=P@ssword!!", "/TCPENABLED=1") ) @@ -69,7 +72,7 @@ $setupPath = Join-Path $downloadPath "SQLEXPR_x64_ENU" #Create directory for temporary files md $downloadPath Set-Location -Path $downloadPath -$installerPath = Start-DownloadWithRetry -Url "https://go.microsoft.com/fwlink/?linkid=866658" -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" +$installerPath = Start-DownloadWithRetry -Url $installerUrl -DownloadPath $downloadPath -Name "SQL2019-SSEI-Expr.exe" Download-FullSQLPackage -InstallerPath $installerPath -DownloadPath $downloadPath Unpack-SQLInstaller -InstallPath "$setupPath.exe" $resultPath = Join-Path $setupPath "SETUP.exe"